How to track memory usage in C ++

I have a C ++ program running under Linux. Is it possible to track memory usage from code? I am allocating new objects and running out of memory, so I want to keep track of how fast I am using memory.

thanks

+2


a source to share


4 answers


The Valgrinds array is exactly what you are looking for.



http://valgrind.org/docs/manual/ms-manual.html

+4


a source


You can overload ::operator new

to keep track of memory usage (usually everything else goes through this).



+1


a source


http://www.paulnettle.com/ press "code" then "MMGR" then the graphic symbol "CODE" in red letters.

MMGR gets into your project. Include it in any source files where you want full memory tracking and everything else. This is truly amazing despite the uselessness of his website.

+1


a source


You can try the experimental heap debugger ; -)

0


a source







All Articles