]> Cypherpunks repositories - gostls13.git/commit
runtime: scavenge large spans before heap growth
authorMichael Anthony Knyszek <mknyszek@google.com>
Thu, 4 Oct 2018 15:33:08 +0000 (15:33 +0000)
committerMichael Knyszek <mknyszek@google.com>
Tue, 30 Oct 2018 15:41:55 +0000 (15:41 +0000)
commitc803ffc67d0c90b24eb5a60a7d573eecc39e7753
tree4fc5a53ed4ae8c34375be30a527f4752514666b5
parentdb82a1bc12c54f1b6d32a3d41c4422605b16b7e8
runtime: scavenge large spans before heap growth

This change scavenges the largest spans before growing the heap for
physical pages to "make up" for the newly-mapped space which,
presumably, will be touched.

In theory, this approach to scavenging helps reduce the RSS of an
application by marking fragments in memory as reclaimable to the OS
more eagerly than before. In practice this may not necessarily be
true, depending on how sysUnused is implemented for each platform.

Fixes #14045.

Change-Id: Iab60790be05935865fc71f793cb9323ab00a18bd
Reviewed-on: https://go-review.googlesource.com/c/139719
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
src/runtime/mheap.go