On May 5, 2010, at 4:27 PM, Philip Mobley wrote:

> I am designing a slightly smarter resource cache that purges less frequently 
> used resources instead of a purge all when getting an UIApplication delegate 
> "applicationDidReceiveMemoryWarning:" message.  I know the target (currently) 
> is 20 MBs (although that could change with future hardware).  The problem I 
> am running into is finding out if I have purged enough.  


What I would probably do is have each cached object check in with a size, and 
track the total cache size separately. When you get a memory warning, shrink 
the cache by about half. If the cache is under a certain size (say 5MB) just 
purge the entire thing.
--
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