• Austin Clements's avatar
    runtime: simplify and cleanup mallocinit · 1cc24690
    Austin Clements authored
    mallocinit has evolved organically. Make a pass to clean it up in
    various ways:
    
    1. Merge the computation of spansSize and bitmapSize. These were
       computed on every loop iteration of two different loops, but always
       have the same value, which can be derived directly from _MaxMem.
       This also avoids over-reserving these on MIPS, were _MaxArena32 is
       larger than _MaxMem.
    
    2. Remove the ulimit -v logic. It's been disabled for many releases
       and the dead code paths to support it are even more wrong now than
       they were when it was first disabled, since now we *must* reserve
       spans and bitmaps for the full address space.
    
    3. Make it clear that we're using a simple linear allocation to lay
       out the spans, bitmap, and arena spaces. Previously there were a
       lot of redundant pointer computations. Now we just bump p1 up as we
       reserve the spaces.
    
    In preparation for #18651.
    
    Updates #5049 (respect ulimit).
    
    Change-Id: Icbe66570d3a7a17bea227dc54fb3c4978b52a3af
    Reviewed-on: https://go-review.googlesource.com/35252Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
    1cc24690
malloc.go 30.8 KB