HACKER Q&A
📣 therobinhood

Memory leaks in C/C++ Application debugger tool?


I have a application which is written in C/C++, when I try to run Valgrind or sanitizer for detecting mem leaks it shows less leaks. But memory is keep growing when the application is running for longer time.


  👤 jay-barronville Accepted Answer ✓
Why not override the allocator functions and track the memory allocations and deallocations yourself?

You can do pretty much anything at that point (e.g., you can track memory allocations and deallocations at only the specific levels you care about)…


👤 iExploder
this is such a generic statement... as long as you de-allocate on exit it wont show up as leak, that doesnt mean the app is not continuously allocating more memory, whether as bug or for a valid reason is up to you to find out...

you can try https://gperftools.github.io/gperftools/heapprofile.html setup HEAP_PROFILE_TIME_INTERVAL and look at the reports to see which code lines keep allocating memory...