• Austin Clements's avatar
    runtime: disentangle next_gc from GC trigger · ec9c84c8
    Austin Clements authored
    Back in Go 1.4, memstats.next_gc was both the heap size at which GC
    would trigger, and the size GC kept the heap under. When we switched
    to concurrent GC in Go 1.5, we got somewhat confused and made this
    variable the trigger heap size, while gcController.heapGoal became the
    goal heap size.
    
    memstats.next_gc is exposed to the user via MemStats.NextGC, while
    gcController.heapGoal is not. This is unfortunate because 1) the heap
    goal is far more useful for diagnostics, and 2) the trigger heap size
    is just part of the GC trigger heuristic, which means it wouldn't be
    useful to an application even if it tried to use it.
    
    We never noticed this mess because MemStats.NextGC is practically
    undocumented. Now that we're trying to document MemStats, it became
    clear that this field had diverged from its original usefulness.
    
    Clean up this mess by shuffling things back around so that next_gc is
    the goal heap size and the new (unexposed) memstats.gc_trigger field
    is the trigger heap size. This eliminates gcController.heapGoal.
    
    Updates #15849.
    
    Change-Id: I2cbbd43b1d78bdf613cb43f53488bd63913189b7
    Reviewed-on: https://go-review.googlesource.com/29270
    Run-TryBot: Austin Clements <austin@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarHyang-Ah Hana Kim <hyangah@gmail.com>
    Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
    ec9c84c8
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...