user380644
user380644

Reputation: 71

C++ memory analysis

What are some of the good tools for analysing memory (for footprint, allocation and deallocation)? I am familiar with valgrind. If there are tools apart from that, would be nice to know about them.

Best.

Upvotes: 4

Views: 1076

Answers (3)

alex tingle
alex tingle

Reputation: 7221

The nice thing about mcheck is that you automatically have it whenever you use glibc. Set the environment variable MALLOC_CHECK_ to 1, and diagnostic is printed on stderr every time heap inconsistency is detected; if set to 2, abort() is called immediately.

The mcheck documentation is here:
http://www.gnu.org/software/libc/manual/html_node/Heap-Consistency-Checking.html

You can also use mtrace to trace malloc in endless detail:
http://www.gnu.org/software/libc/manual/html_node/Allocation-Debugging.html

Upvotes: 1

jdehaan
jdehaan

Reputation: 19928

If you're talking about valgrind I suppose that you are interested in Linux software.

You can easily build your custom report for footprint allocation and deallocation by using MTrace. It is not directly C++ but directly integrated into the GlibC. As far as I know C++ new and delete operators use this to allocate the memory before calling the constructor and deallocate memory after calling the destructor.

Upvotes: 1

Darel
Darel

Reputation: 630

IBM has Rational Purify for both Windows and Linux. I haven't used it, as it's rather costly, but there is a free trial available.

Upvotes: 1

Related Questions