Re: iPhone resource cache - memory question
Re: iPhone resource cache - memory question
- Subject: Re: iPhone resource cache - memory question
- From: Shripada Hebbar <email@hidden>
- Date: Thu, 06 May 2010 09:55:03 +0530
- "x-copyrighted-material: http://www.robosoftin.com"
- Thread-topic: iPhone resource cache - memory question
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, "email@hidden"
<email@hidden> wrote:
>
> Message: 10
> Date: Wed, 5 May 2010 16:27:29 -0700
> From: Philip Mobley <email@hidden>
> Subject: iPhone resource cache - memory question
> To: email@hidden
> Message-ID: <email@hidden>
> 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 (email@hidden)
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:
This email sent to email@hidden