Skip to content

Memory leak when using Assimp #708

Closed

Description

@styxs

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:

  1. 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

  1. turol commented on Dec 12, 2015

    @turol
    Member

    Install Linux and use Valgrind. It can tell you exactly how much memory you're leaking and where it was allocated.

  2. styxs commented on Dec 12, 2015

    @styxs
    Author

    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?

  3. turol commented on Dec 12, 2015

    @turol
    Member

    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.

  4. styxs commented on Dec 12, 2015

    @styxs
    Author

    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!

  5. kimkulling commented on Dec 13, 2015

    @kimkulling
    Member

    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 :-).

  6. styxs commented on Dec 14, 2015

    @styxs
    Author

    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.

  7. kimkulling commented on Jan 20, 2016

    @kimkulling
    Member

    We got a pull request which closes memory leaks which were detected with valgrind. Please open this issue again if the issue still exists.

  8. added a commit that references this issue on Dec 11, 2023
  9. added a commit that references this issue on Feb 5, 2024
  10. added
    Leak
    on Feb 1, 2026
  11. added a commit that references this issue on Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Leak

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions