views:

23

answers:

2

I have an application under development that uses a large amount of memory for images and OpenGL textures.

I have noticed that occasionally, in fact frequently on some devices, SpringBoard, the application which manages the home screen for the iPhone and iPad can take up excessive amounts of memory, sometimes twice as much as normal.

When this happens, it sends my application in to memory warnings and even crashes. My images do get released as soon as possible, but I believe that due to the sheer volume, it simply isn't good enough and still results in crashing...

I can't find much in the Apple docs about SpringBoard, but it's pissing me off.

Any ideas or pointers on figuring out what causes SpringBoard to be so aggressive?

A: 

Your application shouldn't crash in these situations -- it should shut itself down gracefully when the OS tells it to quit. Apple won't document Springboard very much because there's not much they can tell you about it that should affect what you do as a programmer, which boils down to "use as little memory as possible; don't leak memory; quit as quickly as possible when told to quit".

In short, if you're spending any more time worrying about Springboard's behaviour, instead of fixing the crashes in your app, you're not using your time wisely.

Shaggy Frog
I'm not disputing that, but what I want to know is if there is any action my app can take that will cause SpringBoard to allocate additional memory. I can run a monitor on Instruments and watch SpringBoard allocate up to 10MB of memory while my application is running.
Jasconius
I don't know for sure, and neither does anyone besides Apple; and even if we did know why it might happen now, that could change between releases. So, again, you're barking up the wrong tree here. If you spend too much time worrying about things like Springboard (which is out of your control), you won't have the time to spend working on things you can control (like fixing why your app crashes when the device gets in a low-memory situation).
Shaggy Frog
Spent the last 3 hours Instrumenting. Turns out MKAnnotationViews leak into SpringBoard if you don't reuse them. Horrible on Apple's part. They weren't auto-releasing, just pooling up in SpringBoards memory footprint.
Jasconius
Every day I find a new leak in WebKit myself -- and often Leaks can cause my apps to crash that can't be reproduced outside of Leaks. My apps get approved, though. I'm hoping the next version of Xcode and the SDK resolve some of these bugs and these buggy tools.
Shaggy Frog
A: 

The answer was that MKAnnotationViews, despite being autoreleased, were pooling up in the memory footprint of SpringBoard, as opposed to my own app, and were not manifesting themselves very clearly in Instruments.

This is a fairly deceptive thing on Apple's part, particularly in that they allow you to autorelease and never use an object, but it will never actually be released... therefore it is technically not a leak in the eyes of Instruments and static analysis, but can still easily lead to memory related crashes.

Jasconius