When i running my app output shows me a lot of this strings:
2012-05-12 14:41:52.542 PermTour[1688:15c0b] *** __NSAutoreleaseNoPool(): Object 0x5c39520 of class NSCFString autoreleased with no pool in place - just leaking
And i know that the problem in this part of code. Because, when i comment it, output is empty.
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];
}
}
Any ideas? Thnx
UPD.
When i comment all code and it looks like:
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];
}
*/
}
Still memory leaking.. So what you think write now?
UPD 2
When you are dealing with a lot of data(memory), then it is always preferable to use NSAutoreleasePool
.
EDIT -
-(returnType)yourMethod:(returnType)parameter @autoreleasepool
{
@autoreleasepool
{
//method body.
}
}
Hope this will help you.