
基于项目工程编译链接产生的 Linkmap 文件,分析项目中各个模块的大小。
使用时要确保项目的 Build Settings -> Write Link Map File 已置为YES。然后在Path to Link Map File表明的路径里找到自己工程生成的 LinkMap 文件
如 LinkMap 文件内容大致为
# Path: /Users/guomiaoyou/Library/Developer/Xcode/DerivedData/GAG-focyaelrlonzsogsgfnrfxjywimo/Build/Products/Debug-iphonesimulator/GAG.app/GAG # Arch: x86_64 # Object files: [ 0] linker synthesized [ 1] /Users/guomiaoyou/Library/Developer/Xcode/DerivedData/GAG-focyaelrlonzsogsgfnrfxjywimo/Build/Intermediates/GAG.build/Debug-iphonesimulator/GAG.build/GAG.app.xcent [ 2] /Users/guomiaoyou/Library/Developer/Xcode/DerivedData/GAG-focyaelrlonzsogsgfnrfxjywimo/Build/Intermediates/GAG.build/Debug-iphonesimulator/GAG.build/Objects-normal/x86_64/GMYListItem.o [ 3] /Users/guomiaoyou/Library/Developer/Xcode/DerivedData/GAG-focyaelrlonzsogsgfnrfxjywimo/Build/Intermediates/GAG.build/Debug-iphonesimulator/GAG. ... <<dead>> 0x00000007 [ 44] literal string: length <<dead>> 0x00000006 [ 44] literal string: alloc <<dead>> 0x00000008 [ 44] literal string: CGImage <<dead>> 0x00000011 [ 44] literal string: imageOrientation <<dead>> 0x00000023 [ 44] literal string: initWithCGImage:scale:orientation: <<dead>> 0x00000018 [ 44] CIE LinkMapAnalyzer 分析结果各个模块大小为:
# Path: /Users/guomiaoyou/Library/Developer/Xcode/DerivedData/GAG-focyaelrlonzsogsgfnrfxjywimo/Build/Products/Debug-iphonesimulator/GAG.app/GAG # Arch: x86_64 [debug]: 0-unknownFile-unknownModule [debug]: read file line count = 11811 libAFNetworking.a 314.20KB libSDWebImage.a 194.45KB libMasonry.a 94.99KB GAG 55.24KB libSVPullToRefresh.a 43.88KB libarclite_iphonesimulator.a 7.43KB unknownModule 2.04KB libPods-GAG.a 0.25KB [-] totalSize : 0.695766MB [-] Cast Time : 8 1 lynulzy 2016-12-30 15:01:03 +08:00 很方便 |
2 guomiaoyou7784 OP 2016-12-30 16:14:37 +08:00 @lynulzy 谢谢支持。 |
3 XuYanci 2017-03-02 08:22:38 +08:00 via iPhone 能够分析不止是静态 目标文件等大小就更棒了 |
4 guomiaoyou7784 OP @XuYanci 可以讲讲你的具体需求吗?或者在 github 上给我提 issue ,我会抽空解决的 |