-d compileunits shows hard to believe size
brevansio opened this issue · comments
I've been running bloaty on an iOS app recently and found that -d compileunits
, while very helpful in some cases, was consistently telling me that a single .c
file was >20MB. Is it possible that there is something going on when the binary is overly large?
Output from the iOS App (with an embedded static lib)
$ bloaty -n 75 -d compileunits -s file --debug-file=<DSYM> <App Binary>
VM SIZE FILE SIZE
-------------- --------------
36.4% 43.0Mi [5814 Others] 38.6Mi 34.0%
18.1% 21.4Mi external/APNGKit/APNGKit/libpng-apng/pngerror.c 21.4Mi 18.8%
9.9% 11.7Mi [__TEXT,__text] 11.7Mi 10.3%
9.0% 10.7Mi [__DATA,__objc_const] 10.7Mi 9.4%
5.9% 6.93Mi [__LINKEDIT] 6.92Mi 6.1%
3.2% 3.77Mi [__TEXT,__cstring] 3.77Mi 3.3%
1.4% 1.68Mi [__TEXT,__objc_methname] 1.68Mi 1.5%
1.2% 1.43Mi [__DATA,__objc_data] 1.43Mi 1.3%
1.1% 1.29Mi [__TEXT,__unwind_info] 1.29Mi 1.1%
0.8% 1008Ki [__TEXT,__gcc_except_tab] 1008Ki 0.9%
...
100.0% 118Mi TOTAL
Output from the dependent library (built separately)
$ bloaty -n 75 -d compileunits -s file --debug-file=APNGKit.framework.dSYM/Contents/Resources/DWARF/APNGKit APNGKit.framework/APNGKit
VM SIZE FILE SIZE
-------------- --------------
1.2% 19.1Ki [__LLVM,__bundle] 1.27Mi 39.7%
78.7% 1.27Mi /Library/Caches/com.apple.xbs/Sources/arclite_iOS/arclite-76/source/arclite.mm 1.27Mi 39.5%
0.0% 0 [__TEXT,__text] 173Ki 5.3%
5.1% 84.5Ki [__LINKEDIT] 140Ki 4.3%
0.0% 0 [Unmapped] 29.1Ki 0.9%
1.5% 23.9Ki APNGKit/APNGKit/libpng-apng/pngrutil.c 25.5Ki 0.8%
0.7% 12.3Ki [__TEXT] 25.2Ki 0.8%
1.4% 23.1Ki APNGKit/APNGKit/libpng-apng/png.c 25.0Ki 0.8%
0.6% 9.31Ki [__LLVM] 21.7Ki 0.7%
1.2% 19.9Ki APNGKit/APNGKit/libpng-apng/pngread.c 20.4Ki 0.6%
1.2% 19.3Ki APNGKit/APNGKit/libpng-apng/pngrtran.c 19.4Ki 0.6%
1.0% 16.5Ki APNGKit/APNGKit/libpng-apng/pngwutil.c 17.0Ki 0.5%
0.0% 0 [__TEXT,__cstring] 15.8Ki 0.5%
0.9% 14.7Ki APNGKit/APNGKit/APNGImageView.swift 14.8Ki 0.4%
0.9% 14.5Ki APNGKit/APNGKit/APNGImage.swift 14.5Ki 0.4%
0.8% 12.6Ki APNGKit/APNGKit/libpng-apng/pngset.c 12.7Ki 0.4%
0.7% 12.2Ki APNGKit/APNGKit/libpng-apng/pngwrite.c 12.7Ki 0.4%
0.6% 9.36Ki APNGKit/APNGKit/libpng-apng/pngpread.c 9.82Ki 0.3%
0.6% 9.55Ki APNGKit/APNGKit/Disassembler.swift 9.58Ki 0.3%
0.5% 8.04Ki /Users/JP21681/Library/Developer/Xcode/DerivedData/APNGKit-ctwilwszsgnxvzbbionmu 9.09Ki 0.3%
0.3% 4.33Ki [Mach-O Headers] 8.07Ki 0.2%
0.3% 5.11Ki APNGKit/APNGKit/libpng-apng/pngget.c 7.70Ki 0.2%
0.4% 6.44Ki APNGKit/APNGKit/libpng-apng/pngerror.c 7.08Ki 0.2%
...
100.0% 1.61Mi TOTAL 3.21Mi 100.0%
I'm seeing the same thing, for me the first line is
46.8% 27.8Mi /path/to/project/Pods/Folly/folly/json_pointer.cpp 27.8Mi 47.5%
This is after archiving and iOS app and supplying the DWARF data via the command line, full command
bloaty -n 0 -d compileunits --debug-file App.dSYM/Contents/Resources/DWARF/App Payload/App.app/App
Seems like the tool is wrongly associating symbols to their compilation units. When running with the option -d compileunits,sections,symbols
it is possible to observe many unrelated symbols listed under the same compilation unit