Reputation: 1996
I'm creating an iPad app and I'm seeing some strange behaviour. I'm loading texture images on cube faces, each texture has size 1024x1024px.
When I work for some time over my app I'm geting memory warnings while debugging, and application crashes. The more time I work, and more debugging sessions run memory warnings are more often and in worst case memory warnings are fired every time.
When I turn off, and then turn on iPad app is working perfectly, everything is fine and there are no errors (for some period of time...).
Is it possible, that when app crashes while debugging, it doesn't free it's memory? And after multiple crashes iPad has so much garbage from previous leaks, that it cannot run normally?
Upvotes: 1
Views: 615
Reputation: 1996
I have finally resolved this issue ;) it was just a memory cleaning problem in my code.
When I restarted iPad it freed some memory, but after some time it was filled again and when I was allocating a big bitmap image there was a memory warning. Then navigation controllers started to free it's views and there were some bugs that caused memory not clean properly and finally caused application crashes.
Upvotes: 0
Reputation: 69027
What you explain seems to hint at exactly what you suggest, i.e., that after a crash, memory is not completely recovered, at least not immediately. There could be a different explanation, though, that is: the sentinel which supervises memory usage and sends the memory warnings is not able to clean up its state for your app after your app crashes (at least not immediately); so, when you start a new debugging session, it still uses old information as to how much memory your app is using, and so on.
Without knowing the internals of iOS it is difficult, but to clarify thing a bit I would suggest installing one of the many free applications that gives you the device status and the amount of free memory, so you will know, after a crash, how much memory is actually left.
It could be useful, also, introducing the time variable in your observations, or trying to start a different application before restarting yours, or starting yours and then killing it...
Upvotes: 1