On Aug 18, 2009, at 4:53 PM, Jonathon Kuo wrote:

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.


A medium to large malloc() is likely to succeed, even though using all of the memory granted by that allocation is likely to fail. The most significant difference between Mac OS X's virtual memory system and iPhone OSes virtual memory system is that Mac OS X uses a page file, and iPhone OS uses memory warnings.

If you have a lot of read-only data, one valid technique is to use memory mapping to load load the data. iPhone OS, just like Mac OS X, will create a memory region that is marked as backed by the memory mapped file, and will properly handle pages from that file and throw things away if memory is tight (before memory warnings). You can do this with read-write data too, you just have no control over when data is written (and writing to flash can be fairly costly).
--
David Duncan
Apple DTS Animation and Printing

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to