mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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
This commit is contained in:
parent
6120ef0799
commit
ccd1d07cc4
1 changed files with 4 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue