On a Linux / Unix system, you can use the size command for this, for example. on my ubuntu system
size /bin/sh text data bss dec hex filename 102134 1776 11272 115182 1c1ee /bin/sh
Since this is OpenWrt, if you have a different architecture, for example. MIPS or ARM or something else, you should choose the size command of the corresponding toolchain, of course.
Sections have the following meanings
text indicates the size of the executable file codedata is a section of initialized data, for example. variables such as int v = 17; or char name[] = "Tom";bss is an uninitialized or simply 0 initiailized section, int a; or double amount;dec is the total size, in this case 102134 + 1776 + 11272 = 115182hex Finally, this is also the total size, as the hexadecimal value 1c1ee = 115182
But this does not include the stack or heap dynamic memory. To see the total memory usage at runtime, you should look at ps or top .
source share