• Dmitriy Vyukov's avatar
    sync: release Pool memory during second and later GCs · af3868f1
    Dmitriy Vyukov authored
    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
    af3868f1
pool_test.go 3.02 KB