Repository navigation
Description
So I've made a simple OpenGL application using Assimp for the model loading and I've noticed that my application is leaking some memory at startup.
I've tracked down the leaks a bit with several tools like:
- The standard visual studio leak detector which outputs a bunch of leaks of this form:
{170} normal block at 0x00C84B58, 8 bytes long.
Data: < 9 > CC 39 D9 01 00 00 00 00
{169} normal block at 0x00C84D50, 8 bytes long.
Data: <\9 > 5C 39 D9 01 00 00 00 00
{168} normal block at 0x00C84AE8, 8 bytes long.
Data: < ; > 1C 3B D9 01 00 00 00 00
2."Deleaker" which detects about 600 leaks with "no source file" which (i assume) basically means the memory leak isn't in my written code.
3."Dr Memory" which detected about 100 "INVALID HEAP ARGUMENT" leaks e.g:
Error #1: INVALID HEAP ARGUMENT to free 0x01063250 # 0 replace_operator_delete_nothrow [d:\drmemory_package\common\alloc_replace.c:2935]
#1 assimp-vc130-mtd.dll!std::_Deallocate<> [c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory0:138]
#2 assimp-vc130-mtd.dll!std::allocator<>::deallocate [c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory0:640]
#3 assimp-vc130-mtd.dll!std::_Wrap_alloc<>::deallocate [c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory0:911]
#4 assimp-vc130-mtd.dll!std::_Vector_alloc<>::_Free_proxy [c:\program files (x86)\microsoft visual studio 14.0\vc\include\vector:590]
#5 assimp-vc130-mtd.dll!std::_Vector_alloc<>::~_Vector_alloc<> [c:\program files (x86)\microsoft visual studio 14.0\vc\include\vector:552]
#6 assimp-vc130-mtd.dll!std::vector<>::~vector<> [c:\program files (x86)\microsoft visual studio 14.0\vc\include\vector:976]
(and so on)
And Dr Memory actually describes every single leak that im getting with "assimp-vc...."
Something I've noticed while trying to track the leak down:
If I use the standard Visual Studio leak detector (_CrtDumpMemoryLeaks()) in an empty main function (note that I still link to all my libraries and include their headers etc.) it shows the exact same leaks as if I would run my program normally.
So I'm assuming that there is a bug in Assimp or it's a false positive that I maybe should just ignore?
I would appreciate any help regarding on how to deal with it.
Also some other things on what compiler / assimp version I'm using:
- Visual Studio Community 2015
- I tried an unstable Assimp release (3.2) and the latest stable release (3.1.1)
- Windows 10 x64
Activity
turol commentedon Dec 12, 2015
Install Linux and use Valgrind. It can tell you exactly how much memory you're leaking and where it was allocated.
styxs commentedon Dec 12, 2015
But this is what the other tools I've used do aswell. I've created some simple leaks just to check if the other tools would give me the source and the proper size of the leaks which seemed to be the case. They are only unable to specify the source of the leaks for those specific Assimp leaks. So are you sure Valgrind will give me different results?
turol commentedon Dec 12, 2015
Valgrind will give a full stack trace of where the leaking memory was allocated. It will have symbolic names as long as the assimp lib wasn't stripped and if you compiled with debug symbols it will also contain source files and line numbers.
turol commentedon Dec 12, 2015
Another possible tool is rr, see http://robert.ocallahan.org/2015/11/debugging-leaks-with-rr.html . That is also Linux-only.
styxs commentedon Dec 12, 2015
Okay I will install Linux and try out Valgrind tomorrow when I'm on my pc again and will report back with the new information. Thanks!
kimkulling commentedon Dec 13, 2015
Seems to be issues related to vectors. You can also use these tools with full stack trace support. You need to enable this via gflags using windows. And you need to set the symbols in the right way. Then you will get the source location + stacktraces as well.
So even windows supports some good debugging tools :-).
styxs commentedon Dec 14, 2015
I'm now back on my PC and would much prefer debugging it on windows instead. Can you give me any further explanation on how to enable the proper settings or hand me a link? I've googled it and I'm not getting any further than installing the windows debugger package (for gflags). Thanks for taking your time.
kimkulling commentedon Jan 20, 2016
We got a pull request which closes memory leaks which were detected with valgrind. Please open this issue again if the issue still exists.
Update CMakeLists.txt
Update CMakeLists.txt (#5379)
Update CMakeLists.txt (#5379)