如何知道我的二进制可执行文件的内存占用 [英] how to know the memory footprint of my binary executable

查看:306
本文介绍了如何知道我的二进制可执行文件的内存占用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道是否有知道我的二进制可执行文件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 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, 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 executable
  • data is initialized data section, e.g. variables, like int v = 17; or char name[] = "Tom";
  • bss is the uninitialized or simply 0 initiailized section, int a; or double amount;
  • dec is the overall size, in this case 102134 + 1776 + 11272 = 115182
  • hex finally is also the overall size, as a hex value 1c1ee = 115182

这篇关于如何知道我的二进制可执行文件的内存占用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆