Find object memory size
If you want to know the size of your program on disk plus the size of text and data in RAM, on Linux / Unix you can use the size command:
$> size /bin/cat text data bss dec hex filename 43422 1720 2472 47614 b9fe /bin/cat
Size outputs are the memory sizes of different parts of the object file:
- text : (code segment) executable commands
- data : (data segment) initialized global variables
- bss : (block started by characters), statically assigned variables
The last two columns, dec and hex , respectively, are the sum of the other three (total size) in decimal and hexadecimal.
The size you request is: ls output (which gives the size on disk) plus the dec part of the size command output, which gives you the size in RAM.
See also these messages: http://www.cyberciti.biz/faq/linux-find-size-of-text-data-segment-bss-uninitialized-data/ , how to find out the memory size of my binary executable
Find a memory area
When accessing the software application, footprint indicates the size of memory consumed by the running process (memory requirements at run time).
It is said that it is clear that when starting the process you must check the memory area. I think (and other posts confirm this) that the only real option is to use a tool like valgrind .
Your app profile with valgrind
You can profile memory with the Array tool. An array is heap profiling, but can also measure the size of the stack.
valgrind --tool = massif --stacks = yes
This will give you both heap and stack memory usage. Then the information is stored in the file massif.out. ???? what can you read with
ms_print massif.out.
The first output in the file is a good diagram of memory usage during runtime.
-------------------------------------------------------------------------------- Command: ./myprog -f d5.ini Massif arguments: --stacks=yes ms_print arguments: massif.out.24377 -------------------------------------------------------------------------------- MB 5.292^
Details are stored in a file, inside different tables. To fully understand the output, the Valgrind manual is referenced in a page that seems truly understandable.
Ability to track children: --trace-children=yes
Interestingly, there is no "actual memory usage in the process": https://unix.stackexchange.com/questions/164653/actual-memory-usage-of-a-process .