aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/runtime')
-rw-r--r--src/pkg/runtime/malloc.goc4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/pkg/runtime/malloc.goc b/src/pkg/runtime/malloc.goc
index 4d900d63b9..a1db66e1ad 100644
--- a/src/pkg/runtime/malloc.goc
+++ b/src/pkg/runtime/malloc.goc
@@ -351,6 +351,8 @@ runtime·mallocinit(void)
arena_size = MaxMem;
bitmap_size = arena_size / (sizeof(void*)*8/4);
spans_size = arena_size / PageSize * sizeof(runtime·mheap.spans[0]);
+ // round spans_size to pages
+ spans_size = (spans_size + ((1<<PageShift) - 1)) & ~((1<<PageShift) - 1);
p = runtime·SysReserve((void*)(0x00c0ULL<<32), bitmap_size + spans_size + arena_size);
}
if (p == nil) {
@@ -379,6 +381,8 @@ runtime·mallocinit(void)
arena_size = bitmap_size * 8;
spans_size = arena_size / PageSize * sizeof(runtime·mheap.spans[0]);
}
+ // round spans_size to pages
+ spans_size = (spans_size + ((1<<PageShift) - 1)) & ~((1<<PageShift) - 1);
// SysReserve treats the address we ask for, end, as a hint,
// not as an absolute requirement. If we ask for the end