<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Is there a <br><div><div>On May 27, 2011, at 1:16 PM, David Chisnall wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>On 27 May 2011, at 20:47, Ted Kremenek wrote:<br><br><blockquote type="cite">On May 27, 2011, at 12:28 PM, Sean McBride wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Does anyone object if I enable it unconditionally? <br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Sending -drain instead of -release to autorelease pools works in both GC<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">and non-GC mode, while sending -release is a no-op in GC mode, so it's<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">good style to use -drain always (recent Apple examples use -drain even<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">in non-GC mode).<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">And drain works back to 10.4 even.  Personally, I'd like to see this change.<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I think it is fine to worth considering this change because it "makes sense for all users."  If this is in the recommended Cocoa API practices, for example, I'd be more than happy to make this change.  If this makes sense for (say) all GNUStep users, and we can determine that we are using GNUStep, then I'd be fine with turning it on in that case as well because that would make sense for that platform (as decided by those project owners).<br></blockquote><br>This has been the recommended practice for Cocoa since 10.5.</div></blockquote><div><br></div><div>If you can find a documentation reference that clearly states that, then I'm happy to make the switch.  All I see is:</div><div><blockquote type="cite"><span class="Apple-style-span" style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: 13px; "><h3 style="margin-top: 1.5em; margin-bottom: 0.25em; font-size: 19px; font-weight: normal; color: rgb(0, 0, 0); ">Garbage Collection</h3><div style="margin-top: 0px; margin-bottom: 0.833em; font: normal normal normal 100%/normal 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; ">In a garbage-collected environment, there is no need for autorelease pools. You may, however, write a framework that is designed to work in both a garbage-collected and reference-counted environment. In this case, you can use autorelease pools to hint to the collector that collection may be appropriate. In a garbage-collected environment, sending a <code style="font-size: 13px; font-family: Courier, Consolas, monospace; color: rgb(102, 102, 102); "><a href="http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSAutoreleasePool_Class/Reference/Reference.html#//apple_ref/occ/instm/NSAutoreleasePool/drain" style="color: rgb(51, 102, 204); text-decoration: none; ">drain</a></code> message to a pool triggers garbage collection if necessary; <code style="font-size: 13px; font-family: Courier, Consolas, monospace; color: rgb(102, 102, 102); "><a href="http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSAutoreleasePool_Class/Reference/Reference.html#//apple_ref/occ/instm/NSAutoreleasePool/release" style="color: rgb(51, 102, 204); text-decoration: none; ">release</a></code>, however, is a no-op. In a reference-counted environment, <code style="font-size: 13px; font-family: Courier, Consolas, monospace; color: rgb(102, 102, 102); "><a href="http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSAutoreleasePool_Class/Reference/Reference.html#//apple_ref/occ/instm/NSAutoreleasePool/drain" style="color: rgb(51, 102, 204); text-decoration: none; ">drain</a></code> has the same effect as <code style="font-size: 13px; font-family: Courier, Consolas, monospace; color: rgb(102, 102, 102); "><a href="http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSAutoreleasePool_Class/Reference/Reference.html#//apple_ref/occ/instm/NSAutoreleasePool/release" style="color: rgb(51, 102, 204); text-decoration: none; ">release</a></code>. Typically, therefore, you should use <code style="font-size: 13px; font-family: Courier, Consolas, monospace; color: rgb(102, 102, 102); "><a href="http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSAutoreleasePool_Class/Reference/Reference.html#//apple_ref/occ/instm/NSAutoreleasePool/drain" style="color: rgb(51, 102, 204); text-decoration: none; ">drain</a></code>instead of <code style="font-size: 13px; font-family: Courier, Consolas, monospace; color: rgb(102, 102, 102); "><a href="http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSAutoreleasePool_Class/Reference/Reference.html#//apple_ref/occ/instm/NSAutoreleasePool/release" style="color: rgb(51, 102, 204); text-decoration: none; ">release</a></code>.</div></span></blockquote><br></div><div>which is not the same thing.</div></div></body></html>