Re: Allocating too much memory kills my App rather than returning NULL
Re: Allocating too much memory kills my App rather than returning NULL
- Subject: Re: Allocating too much memory kills my App rather than returning NULL
- From: Dave Camp <email@hidden>
- Date: Wed, 09 Nov 2011 09:33:52 -0800
On Nov 8, 2011, at 10:48 PM, Don Quixote de la Mancha wrote:
> On Tue, Nov 8, 2011 at 10:39 PM, Conrad Shultz
> <email@hidden> wrote:
>> And there's a bigger problem. That memory warning notification that you
>> referenced in your first message is there to tell you that you need to
>> free up resources ASAP at run-time. Quoting from the iOS App
>> Programming Guide:
>>
>> "Using large amounts of memory can seriously degrade system performance
>> and potentially cause the system to terminate your app."
> ...
>> You are expected to allocate as LITTLE memory as possible, make caches
>> discardable, and play nicely with memory warnings.
>
> That's just it. I DON'T receive any memory warnings. As far as I can
> tell, neither does the system send my App a UNIX signal.
This was discussed at a WWDC session a couple of years ago. If your app attempts to allocate a large block of memory, and the OS cannot get other processes to give up memory in a timely fashion, your app will be killed.
It's the reverse of you getting the low memory messages. As you take up more and more memory, the OS has to send the low memory messages to other apps to get them to release memory for you. If you allocate memory faster than the OS can re-claim it from other processes, your app will be terminated.
Dave_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden