<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><div style="direction: inherit;">So there are issues we have in swift-corelibs that suffer(leak) because we don't have ARPs on Linux. It would be super nice to have a retain until scope end concept for swift core libs where autorelease would be an accessor in unmanaged that would retain the object until the arp ends scope.</div><br>Sent from my iPhone</div><div><br>On Nov 2, 2016, at 10:17 AM, Jordan Rose &lt;<a href="mailto:jordan_rose@apple.com">jordan_rose@apple.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8"><br class=""><div><blockquote type="cite" class=""><div class="">On Nov 2, 2016, at 09:42, Joe Groff via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class="Apple-interchange-newline">On Nov 1, 2016, at 6:40 PM, Bernardo Breder via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; wrote:<br class=""><br class="">Hello,<br class=""><br class="">I want to create a mini http server project and execute at Ubuntu 15. The Xcode compile and access the function "autoreleasepool", but when i compile the same code at Ubuntu, this function not found<br class=""><br class="">For example, i can compile the code above at Xcode:<br class=""><br class="">while true {<br class="">&nbsp;&nbsp;&nbsp;autoreleasepool {<br class="">&nbsp;&nbsp;&nbsp;var test: Data = "HTTP/1.1 200 OK\r\nContent-Length: 1\r\n\r\na".data(using: .utf8)!<br class="">&nbsp;&nbsp;&nbsp;}<br class="">}<br class=""><br class="">But when i try to compile at Ubuntu:<br class=""><br class="">git@breder:~$ cat main.swift &nbsp;&nbsp;&nbsp;&nbsp;<br class="">import Foundation<br class=""><br class="">while true {<br class="">&nbsp;&nbsp;&nbsp;autoreleasepool {<br class="">&nbsp;&nbsp;&nbsp;var test: Data = "HTTP/1.1 200 OK\r\nContent-Length: 1\r\n\r\na".data(using: .utf8)!<br class="">&nbsp;&nbsp;&nbsp;}<br class="">}<br class=""><br class="">git@breder:~$ swiftc main.swift<span class="Apple-converted-space">&nbsp;</span><br class="">main.swift:4:5: error: use of unresolved identifier 'autoreleasepool'<br class="">&nbsp;&nbsp;&nbsp;autoreleasepool {<br class="">&nbsp;&nbsp;&nbsp;^~~~~~~~~~~~~~~<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Autoreleasepools are an ObjC compatibility feature. They aren't necessary in standalone Swift.</span></div></blockquote><br class=""></div><div>But they <i class="">are</i>&nbsp;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><br class=""></div><div>(/me remembers +[NSAutoreleasePool drain] from the ObjC-GC days)</div><br class=""><div class="">Jordan</div></div></blockquote></body></html>