这里介绍常用iOS内存检查方法原理及具体使用方法(Instrument、XLeaksFinder系列、FB的FBMemoryProfiler)
关于内存问题
网上普遍把内存分为三种类型
Leaked Memory. This is memory that was allocated at some point, but was never released and is no longer referenced by your app.
Abandoned Memory. This is memory that your app has allocated for some reason, but it’s not needed and won’t be referenced. Unlike leaked memory, abandoned memory like this is still referenced somewhere in your app. It just serves no purpose.
Cached memory: Memory still referenced by your application that might be used again for better performance.
其中Leaked Memory就是我们最常提到的内存泄露,Abandoned Memory更像我们常提到的循环引用,但是都属于内存泄露问题。除内存泄露之外,在苹果的About Memory Analysis官方文档中还提到其他的内存使用问题
>
Overall Memory Use. Monitor at a high level how your app uses memory and compare it to the memory usage of other active processes on the system. More.
>
Zombies. This is memory that has been released and is no longer needed, but your code still references it somewhere.
Overall Memory Use是指内存使用过高,Zombies是我们常指的野指针。
下面分别对iOS常用的内存检测方案进行比较