summaryrefslogtreecommitdiff
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
commit7821a66daed8d51c08f72756d41e30311032306b (patch)
tree40c9eb300744c0aee61ed178c930bc6dd7a9b202 /src/testing
parentef1c7b2549a1a3f961b0ce47c79ab2388dea0592 (diff)
downloadgo-7821a66daed8d51c08f72756d41e30311032306b.tar.gz
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 issue 8867. LGTM=rsc R=rsc CC=golang-codereviews https://codereview.appspot.com/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 f91d860a9..e54a3b8ce 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)