资讯详情

C++ exe程序内存占用分析

📅 2026/11/2 14:55:39 | 华诺云谱 👁 阅读
C++ exe程序内存占用分析
编译$ git clone https://github.com/google/bloaty $ cd bloaty $ cmake -B build -G Ninja -S . $ cmake --build build $ cmake --build build --target install命令bloaty.exe --list-sources rmembers the .o files in a .a file compileunits source file for the .o file (translation unit). requires debug info. inputfiles the filename specified on the Bloaty command-line inlines source line/file where inlined code came from. requires debug info. sections object file section segments load commands in the binary symbols symbols from symbol table (configure demangling with --demangle) rawsymbols unmangled symbols fullsymbols full demangled symbols shortsymbols short demangled symbolsbloaty.exe --help USAGE: bloaty [OPTION]... FILE... [-- BASE_FILE...] Options: --csv Output in CSV format instead of human-readable. --tsv Output in TSV format instead of human-readable. -c FILE Load configuration from file. -d SOURCE,SOURCE Comma-separated list of sources to scan. --debug-fileFILE Use this file for debug symbols and/or symbol table. -C MODE How to demangle symbols. Possible values are: --demangleMODE --demanglenone no demangling, print raw symbols --demangleshort demangle, but omit arg/return types --demanglefull print full demangled type The default is --demangleshort. --disassembleFUNCTION Disassemble this function (EXPERIMENTAL) --domainDOMAIN Which domains to show. Possible values are: --domainvm --domainfile --domainboth (the default) -n NUM How many rows to show per level before collapsing other keys into [Other]. Set to 0 for unlimited. Defaults to 20. -s SORTBY Whether to sort by VM or File size. Possible values are: -s vm -s file -s both (the default: sorts by max(vm, file)). -w Wide output; dont truncate long labels. --help Display this message and exit. --list-sources Show a list of available sources and exit. --source-filterPATTERN Only show keys with names matching this pattern. Options for debugging Bloaty: --debug-vmaddrADDR --debug-fileoffOFF Print extended debugging information for the given VM address and/or file offset. -v Verbose output. Dumps warnings encountered during processing and full VM/file maps at the end. Add more vs (-vv, -vvv) for even more.测试#include iostream const char* data 而此时是ii四十九而此时是ii四十九而此时是ii四十九而此时是ii四十九而此时是ii四十九而此时是ii四十九而此时是ii四十九而此时是ii四十九而此时是ii四十九而此时是ii四十九; int main() { printf(test main\n); }g -g main.cpp -o my_program.exe bloaty my_program.exe配置bloaty -c bloaty_package.bloaty my_program.exebloaty_package.bloatycustom_data_source: { name: bloaty_package base_data_source: compileunits rewrite: { pattern: ^(\\.\\./)?src replacement: src } rewrite: { pattern: ^(\\.\\./)?(third_party/\\w) replacement: \\2 } }参考GitHub - google/bloaty: Bloaty: a size profiler for binariesC/C Native 包大小测量_bloaty-CSDN博客创作不易小小的支持一下吧
📝

华诺云谱内容团队

资深建站顾问 · 行业研究员

10年+企业数字化服务经验,专注智能建站、SEO优化与品牌营销,持续输出建站技巧、行业洞察与营销干货,已帮助5000+企业实现数字化增长。

你可能需要的服务

订阅华诺云谱资讯周报

每周一封,精选建站技巧、SEO与营销干货,直达邮箱。已有 8,000+ 企业主订阅,助你少走弯路。

↑