I need to do analysis of memory requirements of one library written in C++, because HW engineers need get some idea about memory requirements of our hardware, there are working on. I can measure heapsize peak, I can measure stack size, but I don't know how to estimate/measure data segment size and Bss size. Is there any method in Visual Studio or GCC? I assume it will differs from compiler to compiler and from platform to platform, but an estimation is fine for me.
During the build:
For VC++ run link.exe /map
.
For GCC run ld -Map
.
Both options generate a map file which will contain the segment sizes.