3 ms·
It really doesn't seem like a terrible idea at all to me; why NOT use demand paging-style memory management for immutable images like UIImages? This is one of t
by swift 16y ago
It really doesn't seem like a terrible idea at all to me; why NOT use demand paging-style memory management for immutable images like UIImages? This is one of the things that virtual memory is good for.
Apple seems to agree. From the documentation for UIImage in the iOS Reference Library (which as far as I can tell is a public page and not under NDA):
"In low-memory situations, image data may be purged from a UIImage object to free up memory on the system. This purging behavior affects only the image data stored internally by the UIImage object and not the object itself. When you attempt to draw an image whose data has been purged, the image object automatically reloads the data from its original file. This extra load step, however, may incur a small performance penalty."
- corysama 16y agoJohn Carmack has mentioned some interesting ideas for keeping large, immutable resources in memory-mapped files on the iPhone. http://bethblog.com/index.php/2010/10/29/john-carmack-discusses-rage-on-iphoneipadipod-touch/ http://bethblog.com/index.php/2010/10/29/john-carmack-discus... (Under "Technical Geek Details")