如何知道我的二进制可执行文件的内存占用 [英] how to know the memory footprint of my binary executable
问题描述
我不知道是否有知道我的二进制可执行文件codeD的C语言内存占用的方法。
有关二进制可执行文件的信息:用OpenWrt的分支(调整心态)的编译工具链和它的体系是x86
块引用>解决方案在Linux / Unix系统中,你可以使用的
尺寸
命令对于这一点,例如:在我的Ubuntu系统尺寸/ bin / sh的
文本数据BSS十进制十六名
102134 1776 11272 115182 1c1ee / bin / sh的由于这是OpenWrt的,如果你有一个不同的架构,例如MIPS或ARM或别的东西,你必须选择,当然适当的工具链的
尺寸
命令。的部分具有以下含义
- 的code尺寸
文本
表示可执行数据
初始化数据段,例如变量,如INT V = 17;
或字符名称[] =汤姆;
BSS
是未初始化或者干脆0
initiailized部分,int类型的;
或双量;
月
是整体规模,在这种情况下102134 + 1776 + 11272 = 115182
十六进制
最后也是整体规模,为十六进制值1c1ee = 115182
I wonder if there is a way to know the memory footprint of my binary executable coded in C language.
informations about binary executable : compiled with toolchain of OpenWrt branch (Attitude Adjustment) and its architecture is x86
解决方案On a Linux/Unix system, you can use the
size
command for this, e.g. on my Ubuntu systemsize /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, e.g. MIPS or ARM or something else, you must pick the
size
command of the appropriate toolchain, of course.The sections have the following meaning
text
denotes the code size of the executabledata
is initialized data section, e.g. variables, likeint v = 17;
orchar name[] = "Tom";
bss
is the uninitialized or simply0
initiailized section,int a;
ordouble amount;
dec
is the overall size, in this case102134 + 1776 + 11272 = 115182
hex
finally is also the overall size, as a hex value1c1ee = 115182
这篇关于如何知道我的二进制可执行文件的内存占用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!