Re: [go-nuts] will GC close unused connection ?

2017-02-16 Thread caspian46
Thanks! I'm going to read it carefully. 在 2017年2月16日星期四 UTC+8下午4:40:54,Konstantin Khomoutov写道: > > On Thu, 16 Feb 2017 00:29:04 -0800 (PST) > casp...@gmail.com wrote: > > > > > Will GC close unused connection ? > > > > > > No. At least not directly. A finalizer can possibly do that and > >

Re: [go-nuts] will GC close unused connection ?

2017-02-16 Thread caspian46
Many thanks! Yes, I know that it is wrong to keep connection without call Close func. just when I working on a bug, I found the connection was closed automatically somehow. 在 2017年2月16日星期四 UTC+8下午4:33:54,Axel Wagner写道: > > Yes, in general, the GC will usually close connections when the >

Re: [go-nuts] will GC close unused connection ?

2017-02-16 Thread Konstantin Khomoutov
On Thu, 16 Feb 2017 00:29:04 -0800 (PST) caspia...@gmail.com wrote: > > > Will GC close unused connection ? > > > > No. At least not directly. A finalizer can possibly do that and > > finalizers are possibly invoked by the GC. [...] > Means yes, GC will close unused connection, just indirectly? >

Re: [go-nuts] will GC close unused connection ?

2017-02-16 Thread 'Axel Wagner' via golang-nuts
Yes, in general, the GC will usually close connections when the corresponding files are collected. But a) you can't really rely on that and b) the number of file descriptors that a program can open is very limited and for many programs, the rate at which they are opened is high enough, that they

Re: [go-nuts] will GC close unused connection ?

2017-02-16 Thread caspian46
Thanks for you reply! Means yes, GC will close unused connection, just indirectly? Cause I found this: #/opt/go/src/net/fd_unix.go func (fd *netFD) setAddr(laddr, raddr Addr) { fd.laddr = laddr fd.raddr = raddr runtime.SetFinalizer(fd, (*netFD).Close) } And this function

Re: [go-nuts] will GC close unused connection ?

2017-02-15 Thread Jan Mercl
On Thu, Feb 16, 2017 at 8:20 AM wrote: > Will GC close unused connection ? No. At least not directly. A finalizer can possibly do that and finalizers are possibly invoked by the GC. -- -j -- You received this message because you are subscribed to the Google Groups