release does not free up memory in low-memory condidtion

Posted by user322945 on Stack Overflow See other posts from Stack Overflow or by user322945
Published on 2010-04-22T06:01:09Z Indexed on 2010/04/22 6:03 UTC
Read the original article Hit count: 534

I am trying to follow the Apple's recommendation to handle low-memory warnings (found in Session 416 of WWDC 2009 videos) by freeing up resources used by freeing up my dataController object (referenced in my app delegate) that contains a large number of strings for read from a plist:

- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
   [_dataController release];
   _dataController = nil;
   NSLog([NSString stringWithFormat:@"applicationDidReceiveMemoryWarning bottom...      retain count:%i", [_dataController retainCount]]);
}      

But when I run ObjectAlloc within Instruments and simulate a Low-Memory Condition, I don't see a decrease in the memory used by my app even though I see the NSLog statements written out and the retain count is zero for the object. I do pass references to the app delegate around to some of the view controllers. But the code above releases the reference to the _dataController object (containing the plist data) so I would expect the memory to be freed.

Any help would be appreciated.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about memory-management