diff options
| author | Michael Stapelberg <stapelberg@debian.org> | 2013-05-14 18:39:35 +0200 | 
|---|---|---|
| committer | Michael Stapelberg <michael@stapelberg.de> | 2013-05-14 18:39:35 +0200 | 
| commit | efcc50dfdc94c82ee0292bf71992ecb7c0123061 (patch) | |
| tree | 17dca99d1dc7fc4e9fe49c2cf6a99d337d4c039f /src/pkg/runtime/malloc.h | |
| parent | 04b08da9af0c450d645ab7389d1467308cfc2db8 (diff) | |
| download | golang-efcc50dfdc94c82ee0292bf71992ecb7c0123061.tar.gz | |
Imported Upstream version 1.1upstream/1.1
Diffstat (limited to 'src/pkg/runtime/malloc.h')
| -rw-r--r-- | src/pkg/runtime/malloc.h | 16 | 
1 files changed, 12 insertions, 4 deletions
| diff --git a/src/pkg/runtime/malloc.h b/src/pkg/runtime/malloc.h index 38122bf8a..52b76d557 100644 --- a/src/pkg/runtime/malloc.h +++ b/src/pkg/runtime/malloc.h @@ -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 @@ -416,10 +424,10 @@ struct MHeap  	byte *arena_end;  	// central free lists for small size classes. -	// the union makes sure that the MCentrals are +	// the padding makes sure that the MCentrals are  	// spaced CacheLineSize bytes apart, so that each MCentral.Lock  	// gets its own cache line. -	union { +	struct {  		MCentral;  		byte pad[CacheLineSize];  	} central[NumSizeClasses]; | 
