mirror of https://github.com/golang/go.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 <iant@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
68527ff4fb
commit
0a51940165
|
|
@ -48,8 +48,11 @@ func GCSys() {
|
||||||
fmt.Printf("OK\n")
|
fmt.Printf("OK\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var sink []byte
|
||||||
|
|
||||||
func workthegc() []byte {
|
func workthegc() []byte {
|
||||||
return make([]byte, 1029)
|
sink = make([]byte, 1029)
|
||||||
|
return sink
|
||||||
}
|
}
|
||||||
|
|
||||||
func GCFairness() {
|
func GCFairness() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue