Skip to content

Commit 0a51940

Browse files
ianlancetaylorbradfitz
authored andcommitted
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 <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 68527ff commit 0a51940

File tree

1 file changed

+4
-1
lines changed
  • src/runtime/testdata/testprog

1 file changed

+4
-1
lines changed

src/runtime/testdata/testprog/gc.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,11 @@ func GCSys() {
4848
fmt.Printf("OK\n")
4949
}
5050

51+
var sink []byte
52+
5153
func workthegc() []byte {
52-
return make([]byte, 1029)
54+
sink = make([]byte, 1029)
55+
return sink
5356
}
5457

5558
func GCFairness() {

0 commit comments

Comments
 (0)