diff options
author | Dmitriy Vyukov <dvyukov@google.com> | 2014-10-16 22:11:26 +0400 |
---|---|---|
committer | Dmitriy Vyukov <dvyukov@google.com> | 2014-10-16 22:11:26 +0400 |
commit | 8f47c837fd4f550c5b3f25f3725c7101c281e363 (patch) | |
tree | 6622677a532dc4798510ca256d75a06ad8899929 /src/runtime/mprof.go | |
parent | 1552e62d70374f86627d7b845ee6effb38a2aebc (diff) | |
download | go-8f47c837fd4f550c5b3f25f3725c7101c281e363.tar.gz go-8f47c837fd4f550c5b3f25f3725c7101c281e363.zip |
runtime: fix memory profiler
There are 3 issues:
1. Skip argument of callers is off by 3,
so that all allocations are deep inside of memory profiler.
2. Memory profiling statistics are not updated after runtime.GC.
3. Testing package does not update memory profiling statistics
before capturing the profile.
Also add an end-to-end test.
Fixes #8867.
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/148710043
Diffstat (limited to 'src/runtime/mprof.go')
-rw-r--r-- | src/runtime/mprof.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/mprof.go b/src/runtime/mprof.go index 89e9915236..f4676fad6e 100644 --- a/src/runtime/mprof.go +++ b/src/runtime/mprof.go @@ -234,7 +234,7 @@ func mProf_GC() { // Called by malloc to record a profiled block. func mProf_Malloc(p unsafe.Pointer, size uintptr) { var stk [maxStack]uintptr - nstk := callers(1, &stk[0], len(stk)) + nstk := callers(4, &stk[0], len(stk)) lock(&proflock) b := stkbucket(memProfile, size, stk[:nstk], true) mp := b.mp() |