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: Greg Parker <email@hidden>
- Date: Fri, 11 Nov 2011 17:32:55 -0800
On Nov 11, 2011, at 5:02 PM, Don Quixote de la Mancha wrote:
> A colleague of mine reports that calloc() works correctly on his
> iPhone 3GS, in that it always returns NULL when he allocates too much
> memory. He is then able to back out of all the allocations and exit
> his minimal test case App without it getting killed by the system.
>
> I suspect now that the death of my App is not due to the conscious
> design of Apple's iOS architects, but some other bug that occurs in my
> particular configuration.
malloc is a complicated system internally, and it's possible that some but not all allocation pathways fail to return NULL on error.
Some allocation paths depend on the requested block size.
Some allocation paths depend on the most recently freed block size, or on a longer history of previously freed blocks.
Some allocation paths depend on thread contention and CPU core affinity.
If you can write a test case that demonstrates a failure without the NULL return, feel free to file a bug report.
--
Greg Parker email@hidden Runtime Wrangler
_______________________________________________
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