小贱贱接到 领导命令,系统占了多少RAM,小贱贱不会啊,浏览器疯狂搜索资料
RAM
RAM:Random Access Memory 随机存取存储器 也叫主存,是与CPU直接交换数据的内部存储器。它可以随时读写(刷新时除外),而且速度很快,主要用来存放操作系统、各种应用程序、数据等。它与ROM的最大区别是数据的易失性,RAM的工作特点是通电后,随时可在任意位置单元存取数据信息,断电后内部信息也随之消失,几乎是所有访问设备中写入和读取速度最快的
SRAM 静态随机存储器 常做cache
DRAM DRAM常用于作主存储器,平常所提到的计算机的内存指的是动态内存(即DRAM),动态内存中所谓的“动态”,指的是当我们将数据写入DRAM后,经过一段时间,数据会丢失,因此需要额外设一个电路进行内存刷新操作
统计
原来DRAM 就是系统跑起来占用的内存。那如何查看
readelf -S xxx elf 文件就可以实现 统计单位Byte
There are 49 section headers, starting at offset 0x107xxxx:
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL xxxxxxxx xxxxxx 000000 00 0 0 0
[ 1] .boot_struct PROGBITS xxxxxxxx xxxxxx 000010 00 A 0 0 4
[ 2] .boot_text_flash PROGBITS xxxxxxxx xxxxxx 000d50 00 AX 0 0 8
[ 3] .vector_table NOBITS xxxxxxxx xxxxxx 000100 00 WA 0 0 4
[ 4] .reboot_param NOBITS xxxxxxxx xxxxxx 000040 00 WA 0 0 4
[ 5] .boot_text_sram PROGBITS xxxxxxxx xxxxxx 001640 00 AX 0 0 8
[ 6] .boot_data_sram PROGBITS xxxxxxxx xxxxxx 00007c 00 WA 0 0 4
[ 7] .boot_bss_sram NOBITS xxxxxxxx xxxxxx 0000a0 00 WA 0 0 4
[ 8] .sram_text PROGBITS xxxxxxxx xxxxxx 003e84 00 AX 0 0 8
[ 9] .sram_data PROGBITS xxxxxxxx xxxxxx 000288 00 WA 0 0 4
[10] .sram_bss NOBITS xxxxxxxx xxxxxx 005274 00 WA 0 0 4
[11] .fast_text_sram PROGBITS xxxxxxxx xxxxxx 0005b0 00 AX 0 0 8
[12] .overlay_text_end PROGBITS xxxxxxxx xxxxxx 000004 00 WA 0 0 1
[13] .overlay_data_end PROGBITS xxxxxxxx xxxxxx 000004 00 WA 0 0 1
[14] .userdata_pool NOBITS xxxxxxxx xxxxxx 002000 00 WA 0 0 4
[15] .psram_text PROGBITS xxxxxxxx xxxxxx 000290 00 AX 0 0 8
[16] .psram_data PROGBITS xxxxxxxx xxxxxx 003200 00 WA 0 0 4
[17] .psram_bss NOBITS xxxxxxxx xxxxxx 2c7bd0 00 WA 0 0 8
[18] .heap NOBITS xxxxxxxx xxxxxx 000100 00 WA 0 0 1
[19] .text PROGBITS xxxxxxxx xxxxxx 10ada8 00 AX 0 0 16
[20] .ARM.extab PROGBITS xxxxxxxx xxxxxx 000018 00 A 0 0 4
[21] .ARM.exidx ARM_EXIDX xxxxxxxx xxxxxx 0000b8 00 AL 19 0 4
[22] .rodata PROGBITS xxxxxxxx xxxxxx 108ed8 00 A 0 0 16
[23] .custom.cmd.table PROGBITS xxxxxxxx xxxxxx 000000 00 W 0 0 1
[24] .thirdparty.event PROGBITS xxxxxxxx xxxxxx 000000 00 W 0 0 1
[25] .data PROGBITS xxxxxxxx xxxxxx 000034 00 WA 0 0 4
[26] .bss NOBITS xxxxxxxx xxxxxx 0006b8 00 WA 0 0 8
[27] .stack_dummy PROGBITS xxxxxxxx xxxxxx 002004 00 W 0 0 1
[28] .system_info PROGBITS xxxxxxxx xxxxxx 000000 00 W 0 0 1
[29] .build_info PROGBITS xxxxxxxx xxxxxx 0000f8 00 A 0 0 4
[30] .code_start_addr PROGBITS xxxxxxxx xxxxxx 000008 00 WA 0 0 1
[31] .custom_parameter NOBITS xxxxxxxx xxxxxx 001000 00 WA 0 0 1
[32] .userdata NOBITS xxxxxxxx xxxxxx 002000 00 WA 0 0 1
[33] .factory NOBITS xxxxxxxx xxxxxx 001000 00 WA 0 0 1
[34] .ARM.attributes ARM_ATTRIBUTES xxxxxxxx xxxxxx 000030 00 0 0 1
[35] .comment PROGBITS xxxxxxxx xxxxxx 00007f 01 MS 0 0 1
[36] .debug_info PROGBITS xxxxxxxx xxxxxx 79fe96 00 0 0 1
[37] .debug_abbrev PROGBITS xxxxxxxx xxxxxx 09a76d 00 0 0 1
[38] .debug_loc PROGBITS xxxxxxxx xxxxxx 27cf5e 00 0 0 1
[39] .debug_aranges PROGBITS xxxxxxxx xxxxxx 0153b8 00 0 0 1
[40] .debug_ranges PROGBITS xxxxxxxx xxxxxx 04dfc0 00 0 0 1
[41] .debug_line PROGBITS xxxxxxxx xxxxxx 123c04 00 0 0 1
[42] .debug_str PROGBITS xxxxxxxx xxxxxx 0d1d93 01 MS 0 0 1
[43] .debug_frame PROGBITS xxxxxxxx xxxxxx 0505d8 00 0 0 4
[44] .stab PROGBITS xxxxxxxx xxxxxx 0000cc 0c 45 0 4
[45] .stabstr STRTAB xxxxxxxx xxxxxx 0001b7 00 0 0 1
[46] .symtab SYMTAB xxxxxxxx xxxxxx 06d8a0 10 47 22131 4
[47] .strtab STRTAB xxxxxxxx xxxxxx 035468 00 0 0 1
[48] .shstrtab STRTAB xxxxxxxx xxxxxx 000253 00 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
L (link order), O (extra OS processing required), G (group), T (TLS),
C (compressed), x (unknown), o (OS specific), E (exclude),
y (purecode), p (processor specific)
上面的size就是 每个Section Headers占用的RAM大小统计的总数就是 占用情况
带有bss,text, data 段是我们一般需要统计