memoryvalgrindmemory-profilingmassif

No symbols for valgrind massif dlclose()


massif doesn't show any function names for functions which are in a lib and this lib is closed by dlclose().

If I remove dlclose(), and run the recompile and execute program I can see the symbols. Is there a way to know the function names without changing the source code?


Solution

  • The new version of valgrind (3.14) has an option that instructs valgrind to keep the symbols of dlclose'd libraries :

    --keep-debuginfo=no|yes   Keep symbols etc for unloaded code [no]
                              This allows saved stack traces (e.g. memory leaks)
                              to include file/line info for code that has been
                              dlclose'd (or similar)
    

    However, massif does not make use of this information.

    You might obtain a usable heap reporting profile by doing:

    valgrind --keep-debuginfo=yes --:xtree-leak=yes

    and then visualise the heap memory using e.g. kcachegrind.