From ccd1d07cc44f3ca033ab7ad9e93ebf97ff3fa94c Mon Sep 17 00:00:00 2001 From: Shenghou Ma Date: Wed, 12 Jun 2013 05:22:49 +0800 Subject: [PATCH] runtime: round spans_size up to page boundary in case we have weird (not page aligned) memory limit. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/10199043 --- src/pkg/runtime/malloc.goc | 4 ++++ 1 file changed, 4 insertions(+) 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<