Skip to content

Memory leak found #31

@rogerpt32

Description

@rogerpt32

I was trying to use the GEMM for a program that has to multiply a large amount of matrices and I found a memory leak. Then I profiled test-gemm and found that the leak is also there as you can see on this Valgrind Memcheck output:

==11320== LEAK SUMMARY:
==11320==    definitely lost: 323,624 bytes in 166 blocks
==11320==    indirectly lost: 300 bytes in 16 blocks
==11320==      possibly lost: 121,368 bytes in 1,088 blocks
==11320==    still reachable: 14,228,175 bytes in 17,865 blocks
==11320==         suppressed: 0 bytes in 0 blocks
==11320== Reachable blocks (those to which a pointer was found) are not shown.
==11320== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==11320==

The problem seems to be here:

==11320== 26,144 bytes in 6 blocks are definitely lost in loss record 1,429 of 1,488
==11320==    at 0x4C3017F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==11320==    by 0x4E93112: std::vector<float, std::allocator<float> >::_M_default_append(unsigned long) (in /home/rogerpt32/isaac/build/libisaac.so)
==11320==    by 0x4E8EFAA: isaac::runtime::Dense::Dense(unsigned char*&) (in /home/rogerpt32/isaac/build/libisaac.so)
==11320==    by 0x4E8F094: isaac::runtime::Layer::read(unsigned char*&) (in /home/rogerpt32/isaac/build/libisaac.so)
==11320==    by 0x4E8F16F: isaac::runtime::Network::Network(unsigned char*) (in /home/rogerpt32/isaac/build/libisaac.so)
==11320==    by 0x4E8F661: isaac::runtime::Profile::Profile(unsigned char*, unsigned long) (in /home/rogerpt32/isaac/build/libisaac.so)
==11320==    by 0x4E8D20E: std::__shared_ptr<isaac::runtime::GEMMProfile, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<isaac::runtime::GEMMProfile>, unsigned char*>(std::_Sp_make_shared_tag, std::allocator<isaac::runtime::GEMMProfile> const&, unsigned char*&&) (in /home/rogerpt32/isaac/build/libisaac.so)
==11320==    by 0x4E6A0EB: __static_initialization_and_destruction_0(int, int) [clone .constprop.78] (in /home/rogerpt32/isaac/build/libisaac.so)
==11320==    by 0x4010732: call_init (dl-init.c:72)
==11320==    by 0x4010732: _dl_init (dl-init.c:119)
==11320==    by 0x40010C9: ??? (in /lib/x86_64-linux-gnu/ld-2.27.so)

With Valgrind massif we can also see the memory leakage but this time it points to:

isaac::driver::Kernel::Kernel(isaac::driver::Module const&, char const*)

The memory leaks for every call to GEMM. It's not a problem for small programs but if anybody wants to run a program using ISAAC with a very large amount of calls to GEMM, it could be problematic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions