Hi,

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..

-Shripada

On 06/05/10 7:13 AM, "cocoa-dev-requ...@lists.apple.com"
<cocoa-dev-requ...@lists.apple.com> wrote:

> 
> Message: 10
> Date: Wed, 5 May 2010 16:27:29 -0700
> From: Philip Mobley <p...@dreystone.com>
> Subject: iPhone resource cache - memory question
> To: Cocoa-dev@lists.apple.com
> Message-ID: <eb4e4887-2fa9-41fa-8d69-1ab675a4a...@dreystone.com>
> Content-Type: text/plain; charset=us-ascii
> 
> 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.
> 
> Is there a method to get the current app memory allocation for the iPhone?
> Also is there a  constant that I can compare it to (memory value to issue
> warning)?
> 
> This would allow me to do a loop something like:
> 
> while (appCurrentMemory > issueMemoryWarningAtValue) {
>   [self purgeOldestAccessedObject];
> }
> 
> 


-----------------------------------------------
Robosoft Technologies - Come home to Technology

Disclaimer: This email may contain confidential material. If you were not an 
intended recipient, please notify the sender and delete all copies. Emails to 
and from our network may be logged and monitored. This email and its 
attachments are scanned for virus by our scanners and are believed to be safe. 
However, no warranty is given that this email is free of malicious content or 
virus.
_______________________________________________

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