首页 > 系统相关 >C++ exe程序内存占用分析

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

时间:2024-08-05 21:24:06浏览次数:12  
标签:symbols exe -- 四十九 C++ ii 内存 file bloaty

编译 
$ 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 symbols

 


bloaty.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-file=FILE  Use this file for debug symbols and/or symbol table.
  -C MODE            How to demangle symbols.  Possible values are:
  --demangle=MODE      --demangle=none   no demangling, print raw symbols
                       --demangle=short  demangle, but omit arg/return types
                       --demangle=full   print full demangled type
                     The default is --demangle=short.
  --disassemble=FUNCTION
                     Disassemble this function (EXPERIMENTAL)
  --domain=DOMAIN    Which domains to show.  Possible values are:
                       --domain=vm
                       --domain=file
                       --domain=both (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; don't truncate long labels.
  --help             Display this message and exit.
  --list-sources     Show a list of available sources and exit.
  --source-filter=PATTERN
                     Only show keys with names matching this pattern.

Options for debugging Bloaty:

  --debug-vmaddr=ADDR
  --debug-fileoff=OFF
                     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 v's (-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.exe

 bloaty_package.bloaty

custom_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 binaries

C/C++ Native 包大小测量_bloaty-CSDN博客


创作不易,小小的支持一下吧!

标签:symbols,exe,--,四十九,C++,ii,内存,file,bloaty
From: https://blog.csdn.net/qq_30220519/article/details/140937199

相关文章

  • 【C++ 面试 - 基础题】每日 3 题(一)
    ✍个人博客:Pandaconda-CSDN博客......
  • 【C++】实验十三
    题目:1、声明Point(点)类,由Point类派生出Circle(圆)类,再由Circle类派生出Cylinder(圆柱)类。将类的定义部分分别作为3个头文件。对它们的成员函数的声明部分分别作为3个源文件(.cpp文件),在主函数中用#include命令把它们包含进来。形成一个完整的程序,并上机运行。2、教材第12章例12.3的......
  • Maven项目报错:failed to execute goal org.apache.maven.plugins:maven-compiler-plug
    创建了一个maven项目,然后在编译时运行错误:“failedtoexecutegoalorg.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile(default-compile)onprojectforum:thepluginorg.apache.maven.plugins:maven-compiler-plugin:3.13.0requiresmavenversion3.6.3-......
  • L2-008 最长对称子串 C++
    对给定的字符串,本题要求你输出最长对称子串的长度。例如,给定IsPAT&TAPsymmetric?,最长对称子串为sPAT&TAPs,于是你应该输出11。输入格式:输入在一行中给出长度不超过1000的非空字符串。输出格式:在一行中输出最长对称子串的长度。输入样例:IsPAT&TAPsymmetric?输出样......
  • 在python jupyter下运行cuda c++程序
    Installrunthisonjupyter(*.ipynb)files!pip3installnvcc4jupyterUsageloadtheextensiontoenablethemagiccommands:%load_extnvcc4jupyterRuncudatest%%cuda#include<stdio.h>__global__voidhello(){printf("Hellofromblock......
  • 在python jupyter下运行cuda c++程序
    Installrunthisonjupyter(*.ipynb)files!pip3installnvcc4jupyterUsageloadtheextensiontoenablethemagiccommands:%load_extnvcc4jupyterRuncudatest%%cuda#include<stdio.h>__global__voidhello(){printf("Hellofromblock......
  • C++类和对象
    文章目录C++类和对象类和对象1.类和对象的基本概念注意事项:2.类的定义和成员注意事项:3.构造函数和析构函数注意事项:4.访问控制和封装注意事项:5.this指针注意事项:6.静态成员注意事项:7.常量成员函数和常量对象注意事项:8.友元函数和友元类注意事项:9......
  • 性能测试之内存瓶颈问题分析与调优
    注意:内存问题是性能分析与调优非常常见的一类问题(内存不足/内存泄露/内存溢出等)一、内存概念:计算机的存储系统分为主存储系统(内存)辅助存储系统(外存)外存:计算机的辅助存储器,包括硬盘、软盘、光盘、网络云盘等【输入-键盘,鼠标,输出-屏幕,音频视频】内存:内存(Memory)又称主存,......
  • C++初学(11)
    不知不觉就第11篇了QWQ11.1、指针和自由存储空间之前提到了计算机程序在存储数据时必须跟踪的3个基本属性:(1)信息存储在何处;(2)存储的值为多少;(3)存储的信息时什么类型。之前我们通过定义一个简单变量,让声明语句指出了值的类型和符号名,让程序为值分配内存,还在内部跟踪该内存单......
  • emsdk安装和编译2个C++基础示例
    参考地址:Downloadandinstall—Emscripten3.1.65-git(dev)documentation 环境:ubuntu24.04LTSgcc(Ubuntu13.2.0-23ubuntu4)13.2.0g++(Ubuntu13.2.0-23ubuntu4)13.2.0cmakeversion3.28.3 Firstcheckthe Platform-specificnotes belowandinstallan......