runtime: L2 arena maps are not accounted for in any runtime.MemStats field #28062
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?go version devel +2bb91e093c
, but this is also true in go 1.11.1 and every version since ec25210 landed.Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?linux/amd64, but the issue is general.
What did you do?
Build and run this program on linux/amd64 and compare its reported value for MemStats.Sys against the value that eg
pmap
will report.On my machine, there is a significant difference; MemStats.Sys is short by 32 MB or so and shows very little allocation outside of HeapSys. If you look at the Linux kernel memory map (with eg
pmap
) or usestrace -e trace=%memory
on the program, it is clearly false, because there is a large 32 MB allocation that is not reflected in MemStats. This allocation is the L2 arena map, allocated in *mheap.syAlloc (currently here). Because this allocation is made by callingpersistentalloc()
with the last parameter beingnil
, it is not accounted for in any memstats value, and on modest Go programs it may amount to a significant amount of their runtime OS level memory usage.(If this is deliberate I believe it's not the right approach, but I suspect it may be an oversight and the CL for the commit doesn't contain any discussion of it either way that I could see. The related
heapArena
structure is accounted for, for example.)The text was updated successfully, but these errors were encountered: