Mastering-Go-Second-Edition/ch02/sliceGC.go
Mihalis Tsoukalos 9c323e5923 GC performance
2019-01-22 12:41:37 +02:00

21 lines
257 B
Go

package main
import (
"runtime"
)
type data struct {
i, j int
}
func main() {
var N = 40000000
var structure []data
for i := 0; i < N; i++ {
value := int(i)
structure = append(structure, data{value, value})
}
runtime.GC()
_ = structure[0]
}