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: Wade Tregaskis <email@hidden>
- Date: Tue, 08 Nov 2011 09:14:36 -0800
>> Before I started writing iOS code I did embedded systems development
>> and Mac OS X device drivers. In both of those environments, Failure
>> Is Not An Option. While you can certainly run out of memory or
>> encounter other errors, one just has to back out gracefully.
>
> This turns out not to be practical in a complex layered application environment. How do you even begin to write recovery code when any method dispatch could fail? How do you test it?
This is a straw man. The existence of tricky edge cases does not justify careless code (nor imply that objc_msgSend is careless).
For background, to anyone still following this thread at this point, I worked for several years in Apple's performance tools team(s). The vast majority of "performance" problems seen in bug reports, developer kitchens, WWDC labs, dev forums and mailing lists revolve around memory. A substantial fraction of those are specifically allocation failures - whether due to bogus arguments to malloc et al, or memory exhaustion on iOS, etc. The vast majority of those come to people's attention through crashes in their apps, often after shipping. Most of those crashes could be averted by simple error checking and graceful failure. Simple as that.
_______________________________________________
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