<div dir="ltr">In my http server i want to manager the memory all the time that we close a socket, like the example of manager in this link: <a href="http://stackoverflow.com/questions/25860942/is-it-necessary-to-use-autoreleasepool-in-a-swift-program">http://stackoverflow.com/questions/25860942/is-it-necessary-to-use-autoreleasepool-in-a-swift-program</a><div><br></div><div>Algorithm that show the ideia:</div><div><br></div><div><i>func request(content) { ... }</i></div><div><i><br></i></div><div><i>let server = myserver()</i></div><div><i>while let client = server.accept() {</i></div><div><b><i> autoreleasepool {</i></b></div><div><i> client.send(request(client.read()))</i></div><div><i> client.close()</i></div><div><b><i> }</i></b></div><div><i>}</i></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-11-02 18:08 GMT-02:00 Joe Groff <span dir="ltr"><<a href="mailto:jgroff@apple.com" target="_blank">jgroff@apple.com</a>></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 1:00 PM, Philippe Hausler <<a href="mailto:phausler@apple.com" target="_blank">phausler@apple.com</a>> wrote:</div><br class="m_-1058758748763843112Apple-interchange-newline"><div><div style="word-wrap:break-word"><div>See:</div><div><br></div><a href="https://github.com/apple/swift-corelibs-foundation/blob/d015466450b2675037c6f1ace8e17e73050ccfb9/Foundation/NSURL.swift#L561" target="_blank">https://github.com/apple/<wbr>swift-corelibs-foundation/<wbr>blob/<wbr>d015466450b2675037c6f1ace8e17e<wbr>73050ccfb9/Foundation/NSURL.<wbr>swift#L561</a><div><br></div><div>This is far and few between of cases that it would be useful but there are a few APIs that we have not been able to express without being able to autorelease items. Most of which we have either forbidden in Linux or redesigned because they were sub-par swift experiences. However it seems reasonable to have a minimal shim to provide cross platform code compatibility even if it does next to nothing. That way trivial code as the original issue showed can easily be directly compiled on either platform without littering gnarly #ifdefs about.</div></div></div></blockquote></div><br></span><div>In the fullness of time, the borrow model will hopefully give us a way to represent those kinds of "returns inner pointer" APIs safely in Swift without relying on dynamic lifetime extension, or awkward 'with { ... }' callbacks.</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>