• Austin Clements's avatar
    [release-branch.go1.9] runtime: fall back to small mmaps if we fail to grow reservation · 1a6d87d4
    Austin Clements authored
    Right now, if it's possible to grow the arena reservation but
    mheap.sysAlloc fails to get 256MB more of memory, it simply fails.
    However, on 32-bit we have a fallback path that uses much smaller
    mmaps that could take in this situation, but fail to.
    
    This commit fixes mheap.sysAlloc to use a common failure path in case
    it can't grow the reservation. On 32-bit, this path includes the
    fallback.
    
    Ideally, mheap.sysAlloc would attempt smaller reservation growths
    first, but taking the fallback path is a simple change for Go 1.9.
    
    Updates #21044 (fixes one of two issues).
    
    Cherry-pick of CL 51713. Updates #21234.
    
    Change-Id: I1e0035ffba986c3551479d5742809e43da5e7c73
    Reviewed-on: https://go-review.googlesource.com/52190
    
    
    Run-TryBot: Austin Clements <austin@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
    1a6d87d4
malloc.go 32.3 KB