c++cmemory-managementvalgrindmemory-footprint

Memory footprint profiling


Suppose I have a program written in C/C++ and I'd like to find out how much of memory was used for data (heap, stack) and how much of memory was used for code (libs, executable files, etc).

I have once measured the dynamic memory space used using 'valgrind' but I don't think is has a feature to profile memory footprint for data and code.

Platform : Mac (possibly Linux)


Solution

  • Your development environment should have some sort of linker options. Generally in such you can instruct it to create a link map. The information you are looking for is likely to be in the link map, or calculable based on the information in the link map.