On Aug 17, 2010, at 5:20 PM, Stuart Rogers wrote:
> On 17 Aug 2010, at 21:36, Cem Karan wrote:
>> On Aug 17, 2010, at 4:05 PM, Stuart Rogers wrote:
>>> 
>>>  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
>>>  ...
>>>  [pool release];
>> 
>> Have you tried using drain instead of release?  That seems to be the 
>> preferred way at this point, triggering GC collection if needed (I don't 
>> know if your code is GC enabled, but if the library code is GC enabled, then 
>> this will solve some of those problems)
> 
> My app is uses retain/release - I have an aversion to garbage collection - so
> (according to the documentation) drain will do exactly the same as release.

Mmm, my question is, what about Apple's code?  I'll be the first to admit, I 
don't know enough about what goes on under the hood, so what I'm about to say 
may be very, very wrong (anyone out there that knows better than me, here is 
your cue to jump in!).  Is it possible that the code that Apple supplies has GC 
turned on, while your code doesn't?  In that case, wouldn't their code not 
garbage collect until its needed, or until it hits a drain statement?  I 
haven't tested it out, but once I found out that Apple started to supply GC 
code, and therefore possibly GC enabled libraries, I switched to using drain 
instead of release for my autorelease pools, just in case...

If you don't have too many places where you create autorelease pools, it might 
be worth it to test it out; your code sounds like it would be the ideal test 
case for such a question!

Thanks,
Cem Karan_______________________________________________

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