aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/malloc.h
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-09-17 14:49:32 -0400
committerRuss Cox <rsc@golang.org>2014-09-17 14:49:32 -0400
commite19d8a47d1803a19446c658712c4bdff84d0da31 (patch)
tree2e7903e0a12d21606597ecc82c38546e11506101 /src/runtime/malloc.h
parenta883f117a9dda5f218bb08dc1c4e181ab1679e11 (diff)
downloadgo-e19d8a47d1803a19446c658712c4bdff84d0da31.tar.xz
runtime: account for tiny allocs, for testing.AllocsPerRun
Fixes #8734. LGTM=r, bradfitz, dvyukov R=bradfitz, r, dvyukov CC=golang-codereviews, iant, khr https://golang.org/cl/143150043
Diffstat (limited to 'src/runtime/malloc.h')
-rw-r--r--src/runtime/malloc.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/runtime/malloc.h b/src/runtime/malloc.h
index 3f1981f708..410a007173 100644
--- a/src/runtime/malloc.h
+++ b/src/runtime/malloc.h
@@ -278,6 +278,8 @@ struct MStats
uint64 nmalloc;
uint64 nfree;
} by_size[NumSizeClasses];
+
+ uint64 tinyallocs; // number of tiny allocations that didn't cause actual allocation; not exported to Go directly
};
#define mstats runtime·memstats
@@ -331,6 +333,7 @@ struct MCache
// See "Tiny allocator" comment in malloc.goc.
byte* tiny;
uintptr tinysize;
+ uintptr local_tinyallocs; // number of tiny allocs not counted in other stats
// The rest is not accessed on every malloc.
MSpan* alloc[NumSizeClasses]; // spans to allocate from