在我的iPhone应用程序在发送一些数据包的应用程序崩溃时,有更多的包的数量及其在Xcode中抛出一个警告说终止应用程序由于内存的压力。在我在几个地方,我已经在分配某些对象的for循环以及将这些分配对象队列代码,以便只是补充说,我要释放这些对象中的for循环后,自ARC启用项目我不能释放,我的问题是在这种情况下将无帮助?而不是释放它,如果我们将这些对象零,,将它释放内存(我知道零不会降低保留计数)被设置为零,将有助于减少内存使用情况?iPhone应用程序崩溃是由于内存压力
说我的代码是什么样的一些类似下面的例子
NSMutableArray* arrObj = [[NSMutableArray alloc]init];
for(i=0; i<=count;i++)
{
ClassA * Obja = [[classA alloc]initwithdata:xx];
ClassB * Objb = [[classB alloc]initwithdata:xx];
ClassC * Objc = [[classC alloc]initwithdata:xx];
[arrObj addObject:obja]; // Since its ARC we cant release obja will obja=nil this help?
[arrObj addObject:objb]; // Since its ARC we cant release objb will objb=nil this help?
[arrObj addObject:objc]; // Since its ARC we cant release objc will objc=nil this help?
}
xx代表什么?它是图像数据吗? – Gaurav
你为什么要分配ClassA * Obja = [[classA alloc] initwithdata:xx]; in循环? –
使用工具:分配以准确查看哪些对象会增加内存占用量。 – Andrei