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: Don Quixote de la Mancha <email@hidden>
- Date: Mon, 07 Nov 2011 13:49:01 -0800
On Mon, Nov 7, 2011 at 7:59 AM, Greg Parker <email@hidden> wrote:
> This is not a safe pattern in a multi-threaded application. You may be checking for failed allocations and responding correctly, but to a close approximation no code anywhere else does so. For example, objc_msgSend sometimes needs to allocate memory, and has no way to recover if it cannot. If some other thread were working at the same time you caused allocation failures, then that thread is likely to crash.
At this point in my application there is only one thread.
Also I'm pretty sure the iOS memory allocator is multithreaded, and
that Apple's code would be good about checking for runtime failures.
If it does not, then that is a bug in the iOS.
--
Don Quixote de la Mancha
Dulcinea Technologies Corporation
Software of Elegance and Beauty
http://www.dulcineatech.com
email@hidden
_______________________________________________
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