Re: Coding with VM limitation on the iPhone?
Re: Coding with VM limitation on the iPhone?
- Subject: Re: Coding with VM limitation on the iPhone?
- From: Steve Christensen <email@hidden>
- Date: Tue, 18 Aug 2009 17:33:31 -0700
On Aug 18, 2009, at 4:53 PM, Jonathon Kuo wrote:
On Aug 18, 2009, at 4:37 PM, Luke the Hiesterman wrote:
Your app will not be paged to the disk at all. It must run
entirely on in physical memory. To know when you're running out of
memory, override -[UIViewController didReceiveMemoryWarning]
On Aug 18, 2009, at 4:38 PM, Alex Kac wrote:
You typically only get about 5-40MB of available RAM. Its not
flash. Its real RAM. But you have no guarantees. The iPhone has a
robust memory system with low memory warnings and such and you
just have to use those to determine if you have enough.
Hmm, that's kind of a harsh environment... The notification
mechanism is great for the purpose of controlling bloat, but
doesn't tell you how much VM you have to play with at the outset. I
suppose all I can do is *try* to alloc() and if it fails, well,
then what? It sounds like it's mostly out of my control if whatever
else is running has already consumed VM. Gotta rethink this entire
thing.
You should probably consider working in more bite-sized chunks,
depending on what you're trying to do, rather than do a massive
malloc and hoping for the best until it fails. Then when you get a
low-memory warning you can at least release the least recently-used
chunk, for example.
And "harsh" is probably the wrong word since it's all relative.
Consider if you'd been doing development on the original Mac back in
1984: 128KB total memory, a 400KB floppy disk and no VM. Having
several megs to work with is downright luxurious... :)
steve
_______________________________________________
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