Re: Garbage collection performance
Re: Garbage collection performance
- Subject: Re: Garbage collection performance
- From: André Pang <email@hidden>
- Date: Fri, 22 Feb 2008 03:09:22 +1100
[Oops, resending it to the list this time, sorry for the double post
A.M.]
On 22/02/2008, at 1:34 AM, A.M. wrote:
Autorelease pools don't exist under GC (or rather, they are non-
functional). By calling -drain, you are informing the GC to run. My
guess is that you are calling -drain in some performance-critical
loop and therefore running GC needlessly often. Try removing -drain
altogether. If you find your app is eating too much memory,
gradually add -collectIfNeeded calls.
Unfortunately, been there, done that... my original code used -
release, which I benchmarked against a version that used -drain, and
using one or the other made no significant difference whatsoever.
You also shouldn't need to call -collectIfNeeded if you use -drain,
since -drain triggers a collection. However, one thing that isn't
mentioned is whether -drain performs a full collection or a
generational collection. I'm presuming it would do a generational
collection; does anyone know?
--
% Andre Pang : trust.in.love.to.save <http://www.algorithm.com.au/>
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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