mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: ensure minimum heap distance via heap goal
Currently we ensure a minimum heap distance of 1MB when computing the assist ratio. Rather than enforcing this minimum on the heap distance, it makes more sense to enforce that the heap goal itself is at least 1MB over the live heap size at the beginning of GC. Currently the two approaches are semantically equivalent, but this will let us switch to basing the assist ratio on current heap distance rather than the initial heap distance, since we can't enforce this minimum on the current heap distance (the GC may never finish because the goal posts will always be 1MB away). Change-Id: I0027b1c26a41a0152b01e5b67bdb1140d43ee903 Reviewed-on: https://go-review.googlesource.com/15604 Reviewed-by: Rick Hudson <rlh@golang.org>
This commit is contained in:
parent
8e8219deb5
commit
9e77c89868
2 changed files with 24 additions and 10 deletions
|
|
@ -423,7 +423,9 @@ func mHeap_Alloc_m(h *mheap, npage uintptr, sizeclass int32, large bool) *mspan
|
|||
memstats.tinyallocs += uint64(_g_.m.mcache.local_tinyallocs)
|
||||
_g_.m.mcache.local_tinyallocs = 0
|
||||
|
||||
gcController.revise()
|
||||
if gcBlackenEnabled != 0 {
|
||||
gcController.revise()
|
||||
}
|
||||
|
||||
s := mHeap_AllocSpanLocked(h, npage)
|
||||
if s != nil {
|
||||
|
|
@ -703,7 +705,9 @@ func mHeap_Free(h *mheap, s *mspan, acct int32) {
|
|||
if acct != 0 {
|
||||
memstats.heap_objects--
|
||||
}
|
||||
gcController.revise()
|
||||
if gcBlackenEnabled != 0 {
|
||||
gcController.revise()
|
||||
}
|
||||
mHeap_FreeSpanLocked(h, s, true, true, 0)
|
||||
if trace.enabled {
|
||||
traceHeapAlloc()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue