[swift-users] Autoreleasepool for Ubuntu
Joe Groff
jgroff at apple.com
Wed Nov 2 15:36:42 CDT 2016
> On Nov 2, 2016, at 1:16 PM, Bernardo Breder via swift-users <swift-users at swift.org> wrote:
>
> 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: 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>
>
> Algorithm that show the ideia:
>
> func request(content) { ... }
>
> let server = myserver()
> while let client = server.accept() {
> autoreleasepool {
> client.send(request(client.read()))
> client.close()
> }
> }
Is `client` really getting autoreleased somewhere? autoreleasepool shouldn't normally be necessary. The client will be released when you go out of scope.
-Joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20161102/4bfe4058/attachment.html>
More information about the swift-users
mailing list