]> Cypherpunks repositories - gostls13.git/commit
runtime: minor clean up to heapminimum
authorAustin Clements <austin@google.com>
Sun, 17 May 2015 01:14:37 +0000 (21:14 -0400)
committerAustin Clements <austin@google.com>
Tue, 19 May 2015 15:30:34 +0000 (15:30 +0000)
commitf4d51eb2f567d12c8b908f9fe3f9650e8a175eb7
tree251b096b1f71c03c0dfc4073e2dad8914efc2a36
parent8903b3db0e889f08587a09566927d6252c9f9ebc
runtime: minor clean up to heapminimum

Currently setGCPercent sets heapminimum to heapminimum*GOGC/100. The
real intent is to set heapminimum to a scaled multiple of a fixed
default heap minimum, not to scale heapminimum based on its current
value. This turns out to be okay because setGCPercent is only called
once and heapminimum is initially set to this default heap minimum.
However, the code as written is confusing, especially since
setGCPercent is otherwise written so it could be called again to
change GOGC. Fix this by introducing a defaultHeapMinimum constant and
using this instead of the current value of heapminimum to compute the
scaled heap minimum.

As part of this, this commit improves the documentation on
heapminimum.

Change-Id: I4eb82c73dc2eb44a6e5a17c780a747a2e73d7493
Reviewed-on: https://go-review.googlesource.com/10181
Reviewed-by: Russ Cox <rsc@golang.org>
src/runtime/mgc.go