【发布时间】:2015-09-14 03:55:26
【问题描述】:
大家! 我现在使用 Xcode 6.2 来开发objective-c,当我尝试使用“仪器”来检测内存问题时,它就像我看到书籍或博客一样不起作用。我使用代码打击来测试(省略了主要功能,使用默认的 xcode&instruments 设置)。
for(int i=0; i<2; i++)
{
KSTestObj *obj0 = [[KSTestObj alloc] init];
KSTestObj *obj1 = [[KSTestObj alloc] init];
obj0.obj = obj1;
obj1.obj = obj0;
}
sleep(100);
并且 KSTestObj 类只有一个 NSObject 属性。 这是一个奇怪的现象。 当我设置 i
2015-06-27 14:33:19.108 ObjCPro_Test[50820:603] init success! 0x7ff968700c10
2015-06-27 14:33:19.109 ObjCPro_Test[50820:603] init success! 0x7ff968700c20
2015-06-27 14:33:19.109 ObjCPro_Test[50820:603] init success! 0x7ff9687003a0
2015-06-27 14:33:19.110 ObjCPro_Test[50820:603] init success! 0x7ff9687003b0
<End of Run>
i
2015-06-27 14:30:17.737 ObjCPro_Test[50789:603] init success! 0x7f7ff1e00830
2015-06-27 14:30:17.738 ObjCPro_Test[50789:603] init success! 0x7f7ff1e004e0
<End of Run>
【问题讨论】:
标签: objective-c xcode memory-leaks instruments