]> Cypherpunks repositories - gostls13.git/commit
runtime: account for all sys memory in MemStats
authorDmitriy Vyukov <dvyukov@google.com>
Fri, 6 Sep 2013 20:55:40 +0000 (16:55 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 6 Sep 2013 20:55:40 +0000 (16:55 -0400)
commita33ef8d11b9db6646991bee5732015562fd4efd2
treea778eda45c6c02b014890cc0e35e6f8c56ee8361
parent52f15df9e2e9fada55c7f132242eb78a8ba4f3ab
runtime: account for all sys memory in MemStats
Currently lots of sys allocations are not accounted in any of XxxSys,
including GC bitmap, spans table, GC roots blocks, GC finalizer blocks,
iface table, netpoll descriptors and more. Up to ~20% can unaccounted.
This change introduces 2 new stats: GCSys and OtherSys for GC metadata
and all other misc allocations, respectively.
Also ensures that all XxxSys indeed sum up to Sys. All sys memory allocation
functions require the stat for accounting, so that it's impossible to miss something.
Also fix updating of mcache_sys/inuse, they were not updated after deallocation.

test/bench/garbage/parser before:
Sys 670064344
HeapSys 610271232
StackSys 65536
MSpanSys 14204928
MCacheSys 16384
BuckHashSys 1439992

after:
Sys 670064344
HeapSys 610271232
StackSys 65536
MSpanSys 14188544
MCacheSys 16384
BuckHashSys 3194304
GCSys 39198688
OtherSys 3129656

Fixes #5799.

R=rsc, dave, alex.brainman
CC=golang-dev
https://golang.org/cl/12946043
19 files changed:
src/pkg/runtime/cpuprof.c
src/pkg/runtime/iface.c
src/pkg/runtime/malloc.goc
src/pkg/runtime/malloc.h
src/pkg/runtime/malloc_test.go
src/pkg/runtime/mem.go
src/pkg/runtime/mem_darwin.c
src/pkg/runtime/mem_freebsd.c
src/pkg/runtime/mem_linux.c
src/pkg/runtime/mem_netbsd.c
src/pkg/runtime/mem_openbsd.c
src/pkg/runtime/mem_plan9.c
src/pkg/runtime/mem_windows.c
src/pkg/runtime/mfixalloc.c
src/pkg/runtime/mgc0.c
src/pkg/runtime/mheap.c
src/pkg/runtime/mprof.goc
src/pkg/runtime/netpoll.goc
src/pkg/runtime/stack.c