views:

175

answers:

1

If an application produces a lot of memory leaks, are they "just" an in-app problem or are they also in RAM after the termination of the application? So does the iPhone OS release the memory allocated for the sandboxed application?

Thank you

+2  A: 

Memory leaks are blocks of memory allocated by the OS for your program to use while it is running, but not correctly returned as not in use when the program has finished with them. So this memory is 'lost'. Your program isn't using it, but the system doesn't yet know that it is free for other use.

When your application finishes running, all of the memory allocated to it by the OS, will be returned for re-use. Which answers your question.

However, memory leaks are a significant bug. On a low-memory device, like an iPhone, the less memory consume, you don't want to be leaking memory as you run. If the device runs low on memory, your application may be terminated or crash, unexpectedly.

cms
That is a generally correct generic answer to memory leaks, but is it iPhone specifically correct?
EBGreen
Yes, as far as I know, iPhone memory management is the same as cocoa applications on OS X, with no support for garbage collection.
cms
I knew there wasn't garbage collection. I just didn't know if you were speaking from personal experience with the iPhone OS or general experience. I suspect that you are right I just wanted to be clear.
EBGreen