diff options
Diffstat (limited to 'src/runtime/export_test.go')
| -rw-r--r-- | src/runtime/export_test.go | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/runtime/export_test.go b/src/runtime/export_test.go index 52d154bf90..f1bdf93f46 100644 --- a/src/runtime/export_test.go +++ b/src/runtime/export_test.go @@ -1260,28 +1260,32 @@ func GCTestPointerClass(p unsafe.Pointer) string { const Raceenabled = raceenabled const ( - GCBackgroundUtilization = gcBackgroundUtilization - GCGoalUtilization = gcGoalUtilization - DefaultHeapMinimum = defaultHeapMinimum + GCBackgroundUtilization = gcBackgroundUtilization + GCGoalUtilization = gcGoalUtilization + DefaultHeapMinimum = defaultHeapMinimum + MemoryLimitHeapGoalHeadroom = memoryLimitHeapGoalHeadroom ) type GCController struct { gcControllerState } -func NewGCController(gcPercent int) *GCController { +func NewGCController(gcPercent int, memoryLimit int64) *GCController { // Force the controller to escape. We're going to // do 64-bit atomics on it, and if it gets stack-allocated // on a 32-bit architecture, it may get allocated unaligned // space. g := Escape(new(GCController)) g.gcControllerState.test = true // Mark it as a test copy. - g.init(int32(gcPercent), maxInt64) + g.init(int32(gcPercent), memoryLimit) return g } func (c *GCController) StartCycle(stackSize, globalsSize uint64, scannableFrac float64, gomaxprocs int) { trigger, _ := c.trigger() + if c.heapMarked > trigger { + trigger = c.heapMarked + } c.scannableStackSize = stackSize c.globalsScan = globalsSize c.heapLive = trigger |
