summaryrefslogtreecommitdiff
path: root/src/runtime/malloc.go
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
commit9be11d3e24860f40dd3ecca43fde0edb7e4d7e09 (patch)
tree87415920c877555397e24c39a9de95a02a6e62c9 /src/runtime/malloc.go
parentbc8a2104707fdf91fe8e6d69a366c979941149e8 (diff)
downloadgo-9be11d3e24860f40dd3ecca43fde0edb7e4d7e09.tar.gz
runtime: account for tiny allocs, for testing.AllocsPerRun
Fixes issue 8734. LGTM=r, bradfitz, dvyukov R=bradfitz, r, dvyukov CC=golang-codereviews, iant, khr https://codereview.appspot.com/143150043
Diffstat (limited to 'src/runtime/malloc.go')
-rw-r--r--src/runtime/malloc.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go
index acf6b48f8..fc22cc29e 100644
--- a/src/runtime/malloc.go
+++ b/src/runtime/malloc.go
@@ -103,7 +103,6 @@ func mallocgc(size uintptr, typ *_type, flags int) unsafe.Pointer {
// standalone escaping variables. On a json benchmark
// the allocator reduces number of allocations by ~12% and
// reduces heap size by ~20%.
-
tinysize := uintptr(c.tinysize)
if size <= tinysize {
tiny := unsafe.Pointer(c.tiny)
@@ -121,6 +120,7 @@ func mallocgc(size uintptr, typ *_type, flags int) unsafe.Pointer {
x = tiny
c.tiny = (*byte)(add(x, size))
c.tinysize -= uintptr(size1)
+ c.local_tinyallocs++
if debugMalloc {
mp := acquirem()
if mp.mallocing == 0 {