• Austin Clements's avatar
    runtime: always give concurrent sweep some heap distance · e30c6d64
    Austin Clements authored
    Currently it's possible for the next_gc heap size trigger computed for
    the next GC cycle to be less than the current allocated heap size.
    This means the next cycle will start immediately, which means there's
    no time to perform the concurrent sweep between GC cycles. This places
    responsibility for finishing the sweep on GC itself, which delays GC
    start-up and hence delays mutator assist.
    
    Fix this by ensuring that next_gc is always at least a little higher
    than the allocated heap size, so we won't trigger the next cycle
    instantly.
    
    Updates #11911.
    
    Change-Id: I74f0b887bf187518d5fedffc7989817cbcf30592
    Reviewed-on: https://go-review.googlesource.com/13043Reviewed-by: default avatarRick Hudson <rlh@golang.org>
    Reviewed-by: default avatarRuss Cox <rsc@golang.org>
    e30c6d64
mgc.go 57 KB