<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Nov 2, 2016, at 1:16 PM, Bernardo Breder 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=""><div dir="ltr" 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="">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:&nbsp;<a href="http://stackoverflow.com/questions/25860942/is-it-necessary-to-use-autoreleasepool-in-a-swift-program" class="">http://stackoverflow.com/questions/25860942/is-it-necessary-to-use-autoreleasepool-in-a-swift-program</a><div class=""><br class=""></div><div class="">Algorithm that show the ideia:</div><div class=""><br class=""></div><div class=""><i class="">func request(content) { ... }</i></div><div class=""><i class=""><br class=""></i></div><div class=""><i class="">let server = myserver()</i></div><div class=""><i class="">while let client = server.accept() {</i></div><div class=""><b class=""><i class="">&nbsp; autoreleasepool {</i></b></div><div class=""><i class="">&nbsp; &nbsp; client.send(request(client.read()))</i></div><div class=""><i class="">&nbsp; &nbsp; client.close()</i></div><div class=""><b class=""><i class="">&nbsp; }</i></b></div><div class=""><i class="">}</i></div></div></div></blockquote></div><br class=""><div class="">Is `client` really getting autoreleased somewhere? autoreleasepool shouldn't normally be necessary. The client will be released when you go out of scope.</div><div class=""><br class=""></div><div class="">-Joe</div></body></html>