【发布时间】:2012-05-12 09:05:55
【问题描述】:
当我运行我的应用程序时,输出显示了很多这样的字符串:
2012-05-12 14:41:52.542 PermTour[1688:15c0b] *** __NSAutoreleaseNoPool(): Object 0x5c39520 of class NSCFString autoreleased with no pool in place - just leaking
而且我知道这部分代码中的问题。因为,当我评论它时,输出是空的。
for(int i=0;i<[dataBase.allDataBase count];i++){
aPLace = [dataBase.allDataBase objectAtIndex:i];
name = [aPLace.name lowercaseString];
description = [aPLace.description lowercaseString];
if (!([name rangeOfString:searchText].location == NSNotFound) || !([description rangeOfString:searchText].location == NSNotFound)){
[foundedPlaces addObject:aPLace];
}
}
有什么想法吗?谢谢
更新。
当我评论所有代码时,它看起来像:
for(int i=0;i<[dataBase.allDataBase count];i++){
aPLace = [dataBase.allDataBase objectAtIndex:i];
name = [aPLace.name lowercaseString];
//description = [aPLace.description lowercaseString];
/*
if (!([name rangeOfString:searchText].location == NSNotFound) || !([description rangeOfString:searchText].location == NSNotFound)){
[foundedPlaces addObject:aPLace];
}
*/
}
还是内存泄漏..那么你现在想写什么呢?
更新 2
【问题讨论】:
-
这个方法是在后台线程调用的吗?
标签: ios xcode memory-leaks nslog