Simplify GC life by zeroing references to closed worker chans and client conns

This commit is contained in:
Aliaksandr Valialkin
2015-12-01 13:32:05 +02:00
parent 7e906e240d
commit a3965934a1
2 changed files with 2 additions and 0 deletions
+1
View File
@@ -901,6 +901,7 @@ func (c *HostClient) connsCleaner() {
// Do not copy(c.conns, c.conns[1:]), since this may be
// quite slow for multi-million conns count.
// Just move c.conns one position ahead.
c.conns[0] = nil
c.conns = c.conns[1:]
}
if c.connsCount == 0 {
+1
View File
@@ -87,6 +87,7 @@ func (wp *workerPool) clean() {
// do not do copy(chans, chans[1:]), since this may be quite slow
// for multi-million concurrent connections. Just move chans
// pointer one position ahead.
chans[0] = nil
chans = chans[1:]
wp.workersCount--
}