Re: Losing my memory - a caching problem?
Re: Losing my memory - a caching problem?
- Subject: Re: Losing my memory - a caching problem?
- From: Shawn Erickson <email@hidden>
- Date: Tue, 17 Aug 2010 17:26:07 -0700
On Tue, Aug 17, 2010 at 3:10 AM, Stuart Rogers <email@hidden> wrote:
> I'm having enormous difficulty keeping tabs on memory usage in my current
> project. I'm happy that I'm not leaking anything - Build & Analyse reports no
> issues, and neither does Instruments (Object Allocations and Leaks). And yet,
> when watching bulk memory usage I see my free RAM dropping like a stone
> (at the expense of my inactive RAM) and within seconds it has chewed through
> 8GB and starts kicking off extra page files. The active RAM usage is fairly
> modest, and nearer to what I would expect.
When you say "free" I assume you mean the "free:" number listed in
activity viewer for the system as a whole?
(sounds like you know this already but...)
If so then what you are seeing is an expected result of the "unified
buffer cache" maintained by the system (since you say private memory
of your application doesn't increase). In a nut shell unused RAM is
wasted RAM so the system always attempts to cache once used pages of
memory (for example file data loaded by your application) as long as
possible until they need to be reused for active / new allocations.
So in general you shouldn't worry about free RAM shrinking to a sliver
of total system RAM over time... however if your application loads
file data (aka image data in your case) only once or it is unlikely
your application will load the same file data again in the reasonable
near future then you should look at disabling file caching of the file
data you load.
Review...
http://developer.apple.com/mac/library/documentation/Performance/Conceptual/FileSystem/Articles/FilePerformance.html#//apple_ref/doc/uid/20001987-99732
I don't think "kCGImageSourceShouldCache" affects caching at the file
system cache level, it only enables/disables cacheing of decoded image
data (aka raw pixels instead of source jpeg data). To avoid file
caching you may have to load file data in a different way...
I would consider asking this question on the quartz developer list.
-Shawn
_______________________________________________
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