]> Cypherpunks repositories - gostls13.git/commit
sync: release Pool memory during second and later GCs
authorDmitriy Vyukov <dvyukov@google.com>
Wed, 22 Oct 2014 16:23:49 +0000 (20:23 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Wed, 22 Oct 2014 16:23:49 +0000 (20:23 +0400)
commitaf3868f1879c7f8bef1a4ac43cfe1ab1304ad6a4
tree9ba4d5f3c32a67f9d5c3634087077a40826bee90
parent18051c086012e3ea279994e987ffe826308f93df
sync: release Pool memory during second and later GCs

Pool memory was only being released during the first GC after the first Put.

Put assumes that p.local != nil means p is on the allPools list.
poolCleanup (called during each GC) removed each pool from allPools
but did not clear p.local, so each pool was cleared by exactly one GC
and then never cleared again.

This bug was introduced late in the Go 1.3 release cycle.

Fixes #8979.

LGTM=rsc
R=golang-codereviews, bradfitz, r, rsc
CC=golang-codereviews, khr
https://golang.org/cl/162980043
src/sync/pool.go
src/sync/pool_test.go