On May 5, 2010, at 9:25 PM, Shripada Hebbar wrote:

> I don't see any point in doing this on our own as the iPhone OS anyway gives 
> you memory warning when we are consuming too much of it, and this is the 
> right occasion to cleanup anything that is not needed ( in 
> applicationDidReceiveMemoryWarning: message).
> 
> Perhaps you are trying to implement some cache such as image or audio 
> specific to your app, in that case, you can in advance set the limit say 5 or 
> 10 MB and if the cache exceeds, delete the least recently used item? Or when 
> you receive memory warning, perhaps delete all items in the cache..


I am trying to implement a generic resource management singleton class that 
will load all of the images, sounds, and data files for the app.  This resource 
manager will keep track of how frequently each object is requested (or in the 
case of sounds when they are played).  Then when an 
applicationDidReceiveMemoryWarning: message was received, the manager would 
purge from memory the less frequently used items (but ready to load them again 
if they are requested).

I am trying to implement David Duncan's suggestion, but because I am dealing 
with images and sound, its not clear how much memory is actually being used 
(although worst case estimates can be made).

Thats why I was wondering if there was a generic approach to get either the 
total app memory used, or get total memory used by a particular object 
(recursively following pointers of course).


_______________________________________________

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