Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/goPublic

Commitb3b1efd

Browse files
committed
runtime: reduce max arena size on windows/amd64 to 32 GiB
Update#5236Update#5402This 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, nightlyoneCC=golang-devhttps://golang.org/cl/9245043
1 parente85016f commitb3b1efd

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

‎src/pkg/runtime/malloc.h‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,18 @@ enum
115115
HeapAllocChunk=1<<20,// Chunk size for heap growth
116116

117117
// Number of bits in page to span calculations (4k pages).
118-
// On 64-bit, we limit the arena to 128GB, or 37 bits.
118+
// On Windows 64-bit we limit the arena to 32GB or 35 bits (see below for reason).
119+
// On other 64-bit platforms, we limit the arena to 128GB, or 37 bits.
119120
// On 32-bit, we don't bother limiting anything, so we use the full 32-bit address.
120121
#ifdef_64BIT
122+
#ifdefGOOS_windows
123+
// Windows counts memory used by page table into committed memory
124+
// of the process, so we can't reserve too much memory.
125+
// See http://golang.org/issue/5402 and http://golang.org/issue/5236.
126+
MHeapMap_Bits=35-PageShift,
127+
#else
121128
MHeapMap_Bits=37-PageShift,
129+
#endif
122130
#else
123131
MHeapMap_Bits=32-PageShift,
124132
#endif
@@ -134,7 +142,7 @@ enum
134142
// This must be a #define instead of an enum because it
135143
// is so large.
136144
#ifdef_64BIT
137-
#defineMaxMem(1ULL<<(MHeapMap_Bits+PageShift))/* 128 GB */
145+
#defineMaxMem(1ULL<<(MHeapMap_Bits+PageShift))/* 128 GBor 32 GB*/
138146
#else
139147
#defineMaxMem((uintptr)-1)
140148
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp