iOS使用Instrument的Leaks查找代码内存泄露

Here are some tips for finding leaks in our project:


1. 打开Instruments调试工具控制栏, Xcode -> Open Dev Tool -> Instruments

iOS使用Instrument的Leaks查找代码内存泄露


2.选择Leaks工具

iOS使用Instrument的Leaks查找代码内存泄露


3.设置Leaks内选项  选择Leaks, 选择Call Tree

iOS使用Instrument的Leaks查找代码内存泄露


4.Run your App !

iOS使用Instrument的Leaks查找代码内存泄露


5.设置Call Tree   选择Invert Call Tree , Hide System Libraries, 然后选择Leaks的项目 Target为你执行中的App, 点击红色圆圈执行,操作你App, 有红色的柱状就代表有内存泄露。查看对应的代码,解决!

iOS使用Instrument的Leaks查找代码内存泄露