diff options
| author | Austin Clements <austin@google.com> | 2015-01-21 16:20:14 +0000 |
|---|---|---|
| committer | Austin Clements <austin@google.com> | 2015-01-21 16:29:17 +0000 |
| commit | e6982fadd2b5b6a8172fca86cfd2e7158fdd0523 (patch) | |
| tree | d1cc6306fa0a53cd80b6a916ca571b761f751a1b /src/runtime | |
| parent | 44529d939192c3034a04e2eff865d04ee51ae532 (diff) | |
| download | go-e6982fadd2b5b6a8172fca86cfd2e7158fdd0523.tar.xz | |
Revert "runtime: fix trigger for concurrent GC"
This reverts commit 44529d939192c3034a04e2eff865d04ee51ae532.
Change-Id: I7671e2cd6f6a476efffa16e8110500a98258c0c1
Reviewed-on: https://go-review.googlesource.com/3130
Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/malloc.go | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go index 014b122b53..223220a570 100644 --- a/src/runtime/malloc.go +++ b/src/runtime/malloc.go @@ -31,12 +31,10 @@ type pageID uintptr // base address for all 0-byte allocations var zerobase uintptr -// triggers the concurrent GC when 1/triggerratio memory is available to allocate. -// Adjust this ratio as part of a scheme to ensure that mutators have enough -// memory to allocate in durring a concurrent GC cycle. -var triggerratio = uint64(8) - // Determine whether to initiate a GC. +// Currently the primitive heuristic we use will start a new +// concurrent GC when approximately half the available space +// made available by the last GC cycle has been used. // If the GC is already working no need to trigger another one. // This should establish a feedback loop where if the GC does not // have sufficient time to complete then more memory will be @@ -46,7 +44,7 @@ var triggerratio = uint64(8) // A false negative simple does not start a GC, a false positive // will start a GC needlessly. Neither have correctness issues. func shouldtriggergc() bool { - return memstats.heap_alloc+memstats.heap_alloc/triggerratio >= memstats.next_gc && atomicloaduint(&bggc.working) == 0 + return memstats.heap_alloc+memstats.heap_alloc*3/4 >= memstats.next_gc && atomicloaduint(&bggc.working) == 0 } // Allocate an object of size bytes. |
