Search code examples
ccode-metrics

measure memory used by static local variables in C code


Are there any static code metrics tools that measure total size of static local variables in c functions. The tools that I explored report the stack size but not the size of the static local variables. Is there another option apart from using linux objdump and parsing the output?


Solution

  • The POSIX size command can be used for this purpose. The size of the data section is the size of all data in static storage (except data declared const on some targets).