1
0
mirror of https://github.com/golang/go synced 2024-11-17 23:14:49 -07:00

runtime: reduce max arena size on windows/amd64 to 32 GiB

Update #5236
Update #5402
This CL reduces gofmt's committed memory from 545864 KiB to 139568 KiB.
Note: Go 1.0.3 uses about 70MiB.

R=golang-dev, r, iant, nightlyone
CC=golang-dev
https://golang.org/cl/9245043
This commit is contained in:
Shenghou Ma 2013-05-07 06:53:02 +08:00
parent e85016f81f
commit b3b1efd882

View File

@ -115,10 +115,18 @@ enum
HeapAllocChunk = 1<<20, // Chunk size for heap growth
// Number of bits in page to span calculations (4k pages).
// On 64-bit, we limit the arena to 128GB, or 37 bits.
// On Windows 64-bit we limit the arena to 32GB or 35 bits (see below for reason).
// On other 64-bit platforms, we limit the arena to 128GB, or 37 bits.
// On 32-bit, we don't bother limiting anything, so we use the full 32-bit address.
#ifdef _64BIT
#ifdef GOOS_windows
// Windows counts memory used by page table into committed memory
// of the process, so we can't reserve too much memory.
// See http://golang.org/issue/5402 and http://golang.org/issue/5236.
MHeapMap_Bits = 35 - PageShift,
#else
MHeapMap_Bits = 37 - PageShift,
#endif
#else
MHeapMap_Bits = 32 - PageShift,
#endif
@ -134,7 +142,7 @@ enum
// This must be a #define instead of an enum because it
// is so large.
#ifdef _64BIT
#define MaxMem (1ULL<<(MHeapMap_Bits+PageShift)) /* 128 GB */
#define MaxMem (1ULL<<(MHeapMap_Bits+PageShift)) /* 128 GB or 32 GB */
#else
#define MaxMem ((uintptr)-1)
#endif