From: Ian Lance Taylor Date: Sat, 7 Jul 2018 05:57:35 +0000 (-0700) Subject: runtime: make TestGcSys actually test something X-Git-Tag: go1.12beta1~1323 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=0a519401651f46a098c5c295943cc1c48e53a48c;p=gostls13.git runtime: make TestGcSys actually test something The workthegc function was being inlined, and the slice did not escape, so there was no memory allocation. Use a sink variable to force memory allocation, at least for now. Fixes #23343 Change-Id: I02f4618e343c8b6cb552cb4e9f272e112785f7cf Reviewed-on: https://go-review.googlesource.com/122576 Run-TryBot: Ian Lance Taylor Reviewed-by: Brad Fitzpatrick --- diff --git a/src/runtime/testdata/testprog/gc.go b/src/runtime/testdata/testprog/gc.go index 744b6108e2..3ca74ba5fe 100644 --- a/src/runtime/testdata/testprog/gc.go +++ b/src/runtime/testdata/testprog/gc.go @@ -48,8 +48,11 @@ func GCSys() { fmt.Printf("OK\n") } +var sink []byte + func workthegc() []byte { - return make([]byte, 1029) + sink = make([]byte, 1029) + return sink } func GCFairness() {