aboutsummaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorDmitriy Vyukov <dvyukov@google.com>2014-10-16 22:11:26 +0400
committerDmitriy Vyukov <dvyukov@google.com>2014-10-16 22:11:26 +0400
commit8f47c837fd4f550c5b3f25f3725c7101c281e363 (patch)
tree6622677a532dc4798510ca256d75a06ad8899929 /src/testing
parent1552e62d70374f86627d7b845ee6effb38a2aebc (diff)
downloadgo-8f47c837fd4f550c5b3f25f3725c7101c281e363.tar.xz
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/testing')
-rw-r--r--src/testing/testing.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/testing/testing.go b/src/testing/testing.go
index f91d860a94..e54a3b8ce4 100644
--- a/src/testing/testing.go
+++ b/src/testing/testing.go
@@ -620,6 +620,7 @@ func after() {
fmt.Fprintf(os.Stderr, "testing: %s\n", err)
os.Exit(2)
}
+ runtime.GC() // materialize all statistics
if err = pprof.WriteHeapProfile(f); err != nil {
fmt.Fprintf(os.Stderr, "testing: can't write %s: %s\n", *memProfile, err)
os.Exit(2)