Friday, March 23, 2012

Memory Profiling


Here we will see about memory profiling, i.e. debugging programs that consume too much memory. Excessive memory consumption can be due to either inefficient data structures, missing memory deallocation, or simply because of an incorrect estimate on how much memory the program will need. Excessive memory use can also increase the runtime of a program, by forcing the program to access main memory instead of the faster cache, and by overflowing the available main memory (paging).

Memory profilers

Memory profilers are tools that do detailed book keeping of memory usage. Because most of these tool only watch dynamic memory allocated on the heap with malloc()/new, they are also called heap profilers. A memory profiler keeps records when a piece of dynamic memory is allocated, by whom (call stack) it was allocated, its size and when and by whom it was deallocated. After the program ends, the memory profiler outputs graphs and log files which reveal details about the memory usage and make it easy to locate the largest memory users.

Some of the memory profilers are:

AQtime

AQtime is a commercial tool sold by AutomatedQA. It is a runtime and memory profiler that works on Windows with the Microsoft, Borland, Intel, Compaq, and GNU compilers. AQtime is integrated into Microsoft Visual Studio and Borland Developer Studio.

Detailed Information can be found at: http://www.automatedqa.com/products/aqtime

mpatrol

mpatrol is an Open Source software memory debugger which also has memory profiling abilities. It is a library that is linked into the executable and intercepts calls to malloc(), free(), and similar functions. The use model is similar to gprof. 

Detailed Information can be found at: http://sourceforge.net/projects/mpatrol

Massif

Massif is a heap profiler. It measures how much heap memory your program uses. This includes both the useful space, and the extra bytes allocated for book-keeping and alignment purposes. It can also measure the size of your program's stack(s), although it does not do so by default. 
It is part of valgrind tool.
Detailed information can be found at: http://valgrind.org/

No comments:

Post a Comment