-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
Milestone
Description
by mgspross:
When running go1.3.3 windows/386 on a 64-bit Windows 7 machine, FreeOSMemory does not
return memory back to the operating system.
FreeOSMemory works correctly with go1.3.3 windows/amd64 on the same machine.
What does 'go version' print?
go version go1.3.3 windows/386
What steps reproduce the problem?
Run the attached go program (memtest.go) on a 64-bit Windows machine, using go1.3.3
windows/386:
set GCDEBUG=gctrace=1 && go run memtest.go
After 5 seconds, the program allocates ~95 MB of memory via a slice. The program then
waits for user input and attempts to release memory with FreeOSMemory periodically.
What happened?
Memory is not returned to the operating system. Running the test program with
GODEBUG=gctrace=1 shows the following, with no change after multiple calls to
FreeOSMemory over a period of time:
inuse: 95, idle:0, sys: 96, released: 0, consumed: 95 (MB)
What should have happened instead?
FreeOSMemory should return memory back to the OS.
Additional information
The amount of memory actually returned to the OS varies with different go releases as
well (I tested the most recent releases). Here are my findings, running memtest.go with
"go run memtest.go" on various go releases:
* go1.3.2 windows/386: The memory is never returned to the OS.
* go1.3.2 windows/amd64: This works correctly. The memory is released and the memory usage returns to close to what it was when the program started (memory in-use was ~1.5MB after FreeOSMemory was called).
* go1.3.3 windows/386: The memory is never returned to the OS.
* go1.3.3 windows/amd64: This works correctly (memory in-use was ~1.5MB after FreeOSMemory was called).
* go1.4rc1 windows/386: Some memory is returned, bu not all of it: ~13.5MB was still in use after FreeOSMemory was called.
* go1.4rc1 windows/amd64: Some memory is returned, but not all of it: ~7.6MB was still in use after FreeOSMemory was called.
These results were all repeatable which each respective release.
P.S. I'm using the 386 build because my the program I'm writing uses interacts with
legacy 32-bit Windows COM libraries, so I can't use the amd64 build in my current
situation.
Attachments:
- memtest.go (647 bytes)