Commit d73ca5f4 authored by Dmitry Vyukov's avatar Dmitry Vyukov

runtime/race: fix memory leak

The leak was reported internally on a sever canary that runs for days.
After a day server consumes 5.6GB, after 6 days -- 12.2GB.
The leak is exposed by the added benchmark.
The leak is fixed upstream in :
http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc?view=diff&r1=276102&r2=276103&pathrev=276103

Fixes #16441

Change-Id: I9d4f0adef48ca6cf2cd781b9a6990ad4661ba49b
Reviewed-on: https://go-review.googlesource.com/25091Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
parent 50048a4e
...@@ -4,4 +4,4 @@ the LLVM project (http://llvm.org/git/compiler-rt.git). ...@@ -4,4 +4,4 @@ the LLVM project (http://llvm.org/git/compiler-rt.git).
To update the .syso files use golang.org/x/build/cmd/racebuild. To update the .syso files use golang.org/x/build/cmd/racebuild.
Current runtime is built on rev 9d79ea3416bfbe3acac50e47802ee9621bf53254. Current runtime is built on rev e35e7c00b5c7e7ee5e24d537b80cb0d34cebb038.
...@@ -221,3 +221,21 @@ func BenchmarkSyncLeak(b *testing.B) { ...@@ -221,3 +221,21 @@ func BenchmarkSyncLeak(b *testing.B) {
} }
wg.Wait() wg.Wait()
} }
func BenchmarkStackLeak(b *testing.B) {
done := make(chan bool, 1)
for i := 0; i < b.N; i++ {
go func() {
growStack(rand.Intn(100))
done <- true
}()
<-done
}
}
func growStack(i int) {
if i == 0 {
return
}
growStack(i - 1)
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment