mirror of
https://github.com/valyala/fasthttp.git
synced 2026-06-13 15:46:49 +03:00
Simplify GC life by zeroing references to closed worker chans and client conns
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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--
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user