> On Nov 2, 2016, at 1:16 PM, Bernardo Breder via swift-users 
> <swift-users@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
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to