• Dmitriy Vyukov's avatar
    runtime: account for all sys memory in MemStats · a33ef8d1
    Dmitriy Vyukov authored
    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
    a33ef8d1
mem_freebsd.c 1.88 KB