Re: iPhone resource cache - memory question

2010-05-06 Thread Philip Mobley
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

Re: iPhone resource cache - memory question

2010-05-06 Thread David Duncan
On May 6, 2010, at 10:13 AM, Philip Mobley wrote: 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). For images I would use a cost estimate of

Re: iPhone resource cache - memory question

2010-05-06 Thread Jens Alfke
On May 6, 2010, at 10:13 AM, Philip Mobley wrote: 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

Re: iPhone resource cache - memory question

2010-05-06 Thread Jens Alfke
On May 6, 2010, at 11:02 AM, David Duncan wrote: For images I would use a cost estimate of width * height * 4 (this is typically what the memory cost to decompress and display an optimized PNG). Agreed. There are CG APIs that let you render an image directly from compressed file data

Re: iPhone resource cache - memory question

2010-05-06 Thread Philip Mobley
On May 6, 2010, at 11:02 AM, David Duncan wrote: 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). For images I would use a cost estimate of

Re: iPhone resource cache - memory question

2010-05-06 Thread David Duncan
On May 6, 2010, at 11:19 AM, Philip Mobley wrote: For images I would use a cost estimate of width * height * 4 (this is typically what the memory cost to decompress and display an optimized PNG). Yes, this is what I was planning for image memory estimates. Should I also add in something

Re: iPhone resource cache - memory question

2010-05-06 Thread Michael Ash
On Thu, May 6, 2010 at 2:12 PM, Jens Alfke j...@mooseyard.com wrote: An intermediate level would be if the library loads the _compressed_ audio. This is a lot less memory usage. It may even memory-map the file, which wouldn't affect your process's heap space at all. (I know the iPhone doesn't

iPhone resource cache - memory question

2010-05-05 Thread Philip Mobley
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

Re: iPhone resource cache - memory question

2010-05-05 Thread David Duncan
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

Re: iPhone resource cache - memory question

2010-05-05 Thread Shripada Hebbar
-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