I\'m stuck with a problem for some time now and I would like to know if anyone can help. I\'m developing an IOS app (iPad) using a main navigation controller and a lot of UI
You can also try for memory leak, Apple's Xcode development environment provide a tools for memory leak detection, the easiest way to run it is straight from
Xcode: 1.Product -> 2.Start with Performance Tool(Profiler) -> 3.From instrument select Leaks.
It seems very good at detecting memory leaks, and easy to figure out.
A memory warning is sent as a notification, so it'll be queued up on the runloop for dispatch as soon as an opportunity arises. If you were to write a (deliberately broken) loop like:
while(1)
{
NSString *newString = [NSString string];
}
Then eventually your app would be killed due to low memory but at no opportunity would it be in a position to receive a low memory warning.
If you're being killed due to low memory without receiving a warning then you've probably creating a memory bottleneck for yourself somewhere, likely you have some sort of loop that leaves a lot of things in the autorelease pool — so, if you get all the way through the loop then the temporary objects vanish and hence have no long-term footprint, but they're accumulating all the time you remain in the loop.
To avoid that sort of situation you want to look at nesting inner parts of the loop in their own NSAutoreleasePool
s. For example, this loop:
while(1)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSString *newString = [NSString string];
[pool drain]; // stylistically preferred to release, but equivalent
// in reference counted environments
}
Will continue forever but won't ever trigger a low memory condition.