<div dir="ltr">I want to manager the memory, using the autoreleasepool block, with ubuntu environment, as we can do with Xcode.</div><div class="gmail_extra"><br><div class="gmail_quote">2016-11-02 15:34 GMT-02:00 Joe Groff <span dir="ltr">&lt;<a href="mailto:jgroff@apple.com" target="_blank">jgroff@apple.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><span class=""><br><div><blockquote type="cite"><div>On Nov 2, 2016, at 10:17 AM, Jordan Rose &lt;<a href="mailto:jordan_rose@apple.com" target="_blank">jordan_rose@apple.com</a>&gt; wrote:</div><br class="m_-7614637801539853133Apple-interchange-newline"><div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><blockquote type="cite"><div><br class="m_-7614637801539853133Apple-interchange-newline">On Nov 2, 2016, at 09:42, Joe Groff via swift-users &lt;<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>&gt; wrote:</div><br class="m_-7614637801539853133Apple-interchange-newline"><div><blockquote type="cite" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br class="m_-7614637801539853133Apple-interchange-newline">On Nov 1, 2016, at 6:40 PM, Bernardo Breder via swift-users &lt;<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>&gt; wrote:<br><br>Hello,<br><br>I want to create a mini http server project and execute at Ubuntu 15. The Xcode compile and access the function &quot;autoreleasepool&quot;, but when i compile the same code at Ubuntu, this function not found<br><br>For example, i can compile the code above at Xcode:<br><br>while true {<br>   autoreleasepool {<br>   var test: Data = &quot;HTTP/1.1 200 OK\r\nContent-Length: 1\r\n\r\na&quot;.data(using: .utf8)!<br>   }<br>}<br><br>But when i try to compile at Ubuntu:<br><br>git@breder:~$ cat main.swift     <br>import Foundation<br><br>while true {<br>   autoreleasepool {<br>   var test: Data = &quot;HTTP/1.1 200 OK\r\nContent-Length: 1\r\n\r\na&quot;.data(using: .utf8)!<br>   }<br>}<br><br>git@breder:~$ swiftc main.swift<span class="m_-7614637801539853133Apple-converted-space"> </span><br>main.swift:4:5: error: use of unresolved identifier &#39;autoreleasepool&#39;<br>   autoreleasepool {<br>   ^~~~~~~~~~~~~~~<br></blockquote><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">Autoreleasepools are an ObjC compatibility feature. They aren&#39;t necessary in standalone Swift.</span></div></blockquote><br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">But they<span class="m_-7614637801539853133Apple-converted-space"> </span><i>are</i> necessary in Swift programs on Apple platforms (that don’t use RunLoop, anyway). Philippe, what do you think? What’s the right way to write cross-platform code that doesn’t use RunLoop or dispatch_main for an implicit autorelease pool?</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">(/me remembers +[NSAutoreleasePool drain] from the ObjC-GC days)</div></div></blockquote></div><br></span><div>If you must, you could conditionally define `autoreleasepool` to just call its argument as a compatibility shim.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>-Joe</div></font></span></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Nome : Bernardo Breder<br>Product : Breder Language<br>Site : <a href="http://bernardobreder.com/" target="_blank">bernardobreder.com</a><br>Email : <a href="mailto:bernardobreder@gmail.com" target="_blank">bernardobreder@gmail.com<br></a><div>Email : <a href="mailto:bbreder@tecgraf.puc-rio.br" target="_blank">bbreder@tecgraf.puc-rio.br</a></div><div>Email : <a href="mailto:contato@bernardobreder.com" target="_blank">contato@bernardobreder.com</a><br>Graduação : UFF - Ciência da Computação<div>Mestrado : UFF - Ciência da Computação<br>Trabalho : TecGraf - PUC-RIO</div></div></div></div>
</div>