基于项目工程编译链接产生的 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
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.