• Michael Anthony Knyszek's avatar
    runtime: scavenge large spans before heap growth · c803ffc6
    Michael Anthony Knyszek authored
    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: 's avatarAustin Clements <austin@google.com>
    c803ffc6
mheap.go 53 KB