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: Tue, 8 Nov 2011 23:46:40 -0800
On Nov 8, 2011, at 10:56 PM, Don Quixote de la Mancha wrote:
> On Tue, Nov 8, 2011 at 10:49 PM, Kyle Sluder <email@hidden> wrote:
>> On Tue, Nov 8, 2011 at 10:44 PM, Don Quixote de la Mancha
>> <email@hidden> wrote:
>>> Kids These Days.
>>>
>>> While the Space Shuttle exploded twice, I hasten to point out that
>>> neither of those failures was due to software bugs.
>>
>> The Shuttle's software was a closed real-time system written entirely
>> by one team within NASA that followed incredibly strict code-auditing
>> and development procedures. We studied it in college.
>>
>> If you tried to follow the NASA's development methodology, your
>> competitors would eat your breakfast, lunch, and dinner before you
>> shipped v1.0.
>
> That's the problem I'm trying to fix by demonstrating that software
> doesn't have to crash.
>
> The reason competitors eat the lunch of careful coders is that
> end-users are conditioned to expect that their products will be
> unreliable.
No, the reason is that most end-users do not want to pay Space Shuttle prices (high) for Space Shuttle capability and flexibility (low).
Note that Shuttle missions carried ordinary laptops running ordinary operating systems to do the science work other than flying the spacecraft. The scientists couldn't afford Shuttle-grade development costs nor Shuttle-grade development schedules.
> 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.
Go back to Dave Zarzycki's message earlier in the thread. There are two resources called "memory" that you can exhaust.
Physical pages. If you use too many physical pages, then iOS will send you memory warnings and, if you don't relinquish enough memory in response, kill you.
Virtual address space. If you fill your virtual address space, then malloc and mmap may fail and other frameworks may crash.
The best way to avoid running out of virtual address space is to hard-code a maximum data size that you know will fit, with a generous fudge factor to allow for future expansion of the frameworks' virtual address space footprint.
--
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