Clone this repo:
  1. c9b5da2 Temporarily exclude symbols of negative sizee by Yifei Teng · 8 months ago main master
  2. 55b7707 Support DW_FORM_strx3 by Yifei Teng · 8 months ago
  3. 6eaf778 Merge remote-tracking branch 'haberman/master' by Yifei Teng · 8 months ago
  4. 60209eb Merge pull request #264 from learn-more/pe_lit by Joshua Haberman · 9 months ago
  5. a985196 Update old PE tests by Mark Jansen · 9 months ago

Bloaty: a size profiler for binaries


Ever wondered what‘s making your binary big? Bloaty will show you a size profile of the binary so you can understand what’s taking up space inside.

$ ./bloaty bloaty -d compileunits
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  34.8%  10.2Mi  43.4%  2.91Mi    [163 Others]
  17.2%  5.08Mi   4.3%   295Ki    third_party/protobuf/src/google/protobuf/
   7.3%  2.14Mi   2.6%   179Ki    third_party/protobuf/src/google/protobuf/
   4.6%  1.36Mi   1.1%  78.4Ki    third_party/protobuf/src/google/protobuf/
   3.7%  1.10Mi   4.5%   311Ki    third_party/capstone/arch/ARM/ARMDisassembler.c
   1.3%   399Ki  15.9%  1.07Mi    third_party/capstone/arch/M68K/M68KDisassembler.c
   3.2%   980Ki   1.1%  75.3Ki    third_party/protobuf/src/google/protobuf/
   3.2%   965Ki   0.6%  40.7Ki    third_party/protobuf/src/google/protobuf/
   2.8%   854Ki  12.0%   819Ki    third_party/capstone/arch/X86/X86Mapping.c
   2.8%   846Ki   1.0%  66.4Ki    third_party/protobuf/src/google/protobuf/
   2.7%   800Ki   0.6%  41.2Ki    third_party/protobuf/src/google/protobuf/
   2.3%   709Ki   0.7%  50.7Ki    third_party/protobuf/src/google/protobuf/
   2.1%   637Ki   1.7%   117Ki    third_party/demumble/third_party/libcxxabi/cxa_demangle.cpp
   1.8%   549Ki   1.7%   114Ki    src/
   1.7%   503Ki   0.7%  48.1Ki    third_party/protobuf/src/google/protobuf/
   1.6%   469Ki   6.2%   427Ki    third_party/capstone/arch/X86/X86DisassemblerDecoder.c
   1.4%   434Ki   0.2%  15.9Ki    third_party/protobuf/src/google/protobuf/
   1.4%   422Ki   0.3%  23.4Ki    third_party/re2/re2/
   1.3%   407Ki   0.4%  24.9Ki    third_party/re2/re2/
   1.3%   407Ki   0.4%  29.9Ki    third_party/protobuf/src/google/protobuf/
   1.3%   397Ki   0.4%  24.8Ki    third_party/re2/re2/
 100.0%  29.5Mi 100.0%  6.69Mi    TOTAL

Bloaty performs a deep analysis of the binary. Using custom ELF, DWARF, and Mach-O parsers, Bloaty aims to accurately attribute every byte of the binary to the symbol or compileunit that produced it. It will even disassemble the binary looking for references to anonymous data.

Bloaty supports many features:

  • file formats: ELF, Mach-O, PE/COFF (experimental), WebAssembly (experimental)
  • data sources: compileunit (shown above), symbol, section, segment, etc.
  • hierarchical profiles: combine multiple data sources into a single report
  • size diffs: see where the binary grew, perfect for CI tests
  • separate debug files: strip the binary under test, while making debug data available for analysis
  • flexible demangling: demangle C++ symbols, optionally discarding function/template parameters
  • custom data sources: regex rewrites of built-in data sources, for custom munging/bucketing
  • regex filtering: filter out parts of the binary that do or don't match a given regex
  • easy to deploy: statically-linked C++ binary, easy to copy around

For detailed info on all of Bloaty's features, see the User Documentation.

For more information about the analysis performed by Bloaty, please see How Bloaty Works.


To build, use cmake. For example:

$ cmake -B build -G Ninja -S .
$ cmake --build build
$ cmake --build build --target install

Bloaty bundles libprotobuf, re2, capstone, and pkg-config as Git submodules, and uses protoc build from libprotobuf, but it will prefer the system's versions of those dependencies if available. All other dependencies are included as Git submodules.

If the Git repository hasn't been cloned with the --recursive, the submodules can be checked out with:

$ git submodule update --init --recursive

To run the tests, see the info in tests/


GitHub issues and PRs welcome. Please include tests when possible, see: tests/

This is not an official Google product.