[cfe-dev] NSAutoreleasePool checker

Sean McBride sean at rogue-research.com
Fri May 27 12:28:50 PDT 2011


On Fri, 27 May 2011 11:14:04 +0100, David Chisnall said:

>Currently the NSAutoreleasePool checker in the static analyser is only
>enabled in GC mode.

Which is kinda weird, since, as Apple's docs say: "In a garbage-
collected environment, there is no need for autorelease pools."

Maybe the checker should warn that using pools is useless?  :) 
Presumably, the assumption is that the code in question is in fact dual mode.

>Does anyone object if I enable it unconditionally? 
>Sending -drain instead of -release to autorelease pools works in both GC
>and non-GC mode, while sending -release is a no-op in GC mode, so it's
>good style to use -drain always (recent Apple examples use -drain even
>in non-GC mode).

And drain works back to 10.4 even.  Personally, I'd like to see this change.

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada






More information about the cfe-dev mailing list