I am unable to release NSMutableArray that I created in a method.
SqliteData *s = [SqliteData alloc];
items = [NSArray alloc];
items = [s getItems:parent];
[s release];
IN SQLITeDATA class
-(NSMutableArray *)getItems:(NSString *)parent
{
NSMutableArray *items = [[[NSMutableArray alloc] init]autorelease];
return items
}
The app crashes, if I remove the autorelease it works fine.
The correct version is :
Which is similar, but less optimized, to :
Beware about memory leaks :
You are leaking memory, since your replace newly allocated
itemsaddress with another.And
allocwithoutinitis a non-sense. (you are allocating memory, but not initialized it!)