Instruments--使用instrument测试是否内存泄露

使用instrument测试内存泄露

工具 Allocations

使用标记,可以更省事省力的测试页面是否有内存泄露

1、设置Generations

Instruments--使用instrument测试是否内存泄露_第1张图片
1.png

2、选择mark generation

Instruments--使用instrument测试是否内存泄露_第2张图片
0.png

3、使用方法

在进入测试页面之前,mark一下----->进入页面----->退出----->mark------>进入------->退出------->mark------>进入
如此往复5、6次,就可以看到如下结果


Instruments--使用instrument测试是否内存泄露_第3张图片
00.png

这种情况下是内存有泄露,看到每次的增量都是好几百K或者上M的,都是属于内存有泄露的,这时候就需要检测下代码

一般情况下,100K以下都属于正常范围,growth表示距离你上次mark的增量

你可能感兴趣的:(Instruments--使用instrument测试是否内存泄露)