google / bloaty

Bloaty: a size profiler for binaries

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bloaty reports unreasonably high values when using -d fullsymbols on macos (mach-0)

bschindler opened this issue · comments

I ran bloaty on an internal shared library using -d fullsymbols and got values that seem unreasonable to me. The library is proprietary, so I blanked out the names

    FILE SIZE        VM SIZE
 --------------  --------------
  40.8%  31.4Mi  40.8%  31.4Mi    [45105 Others]
  27.7%  21.2Mi  27.7%  21.2Mi    guard variable for xxxxxxxxx::var
  13.0%  9.95Mi  13.0%  9.96Mi    [__LINKEDIT]
   1.7%  1.34Mi   1.7%  1.34Mi    [__DATA,__data]
   1.2%   933Ki   1.2%   933Ki    std::__1::piecewise_construct
   0.9%   708Ki   0.9%   708Ki    guard variable for xxxx::var
   0.4%   276Ki   0.4%   276Ki    typeinfo name for type1
   0.3%   209Ki   0.3%   209Ki    typeinfo name for type2

First, I find the guard variables unbelievable. The static variable this is referring to is indeed a larger array, but it should be about 1kb in size, not 21mb. Also, I have a hard time believing that typeinfo name for types take a few hundred kb.

Thanks for the report. Would it be possible to reduce this down to a smaller, non-proprietary repro? I can believe Bloaty is making a mistake here, but it's hard to diagnose and fix without more info.

I just figured that undefined behavior sanitizer was turned on that binary. I turned it off and bloaty behaves just fine now. Sorry for the noise