• 何もしなくても2分に⼀回強制的にGCが⾛っている https://github.com/golang/go/blob/827564191b9796a764e970175cecd51c2030530e/src/runtime/proc.go#L6504-L6509 • 数分に⼀回動かしてもきっと⼤丈夫! // forcegcperiod is the maximum time in nanoseconds between garbage // collections. If we go this long without a garbage collection, one // is forced to run. // // This is a variable for testing purposes. It normally doesn't change. var forcegcperiod int64 = 2 * 60 * 1e9
./main.go:19:35: live at call to NotifyContext: .autotmp_16 ./main.go:19:35: live at call to newobject: .autotmp_16 ./main.go:22:19: live at call to Open: .autotmp_16 ctx.data ./main.go:25:2: live at call to newproc: .autotmp_16 ctx.data db ./main.go:30:2: live at call to chanrecv1: .autotmp_16 db ./main.go:30:12: live at indirect call: .autotmp_16 db ./main.go:32:1: live at indirect call: .autotmp_16 chanrecv1が <- ctx.Done で待つところ そのセーフポイントでlive なシンボルが⼀覧で表⽰さ れる
./main.go:19:35: live at call to NotifyContext: .autotmp_16 ./main.go:19:35: live at call to newobject: .autotmp_16 ./main.go:22:19: live at call to Open: .autotmp_16 ctx.data ./main.go:25:2: live at call to newproc: .autotmp_16 ctx.data db ./main.go:30:2: live at call to chanrecv1: .autotmp_16 db ./main.go:30:12: live at indirect call: .autotmp_16 db ./main.go:32:1: live at indirect call: .autotmp_16 ./main.go:18:35: live at call to NotifyContext: .autotmp_16 ./main.go:18:35: live at call to newobject: .autotmp_16 ./main.go:21:19: live at call to Open: .autotmp_16 ctx.data ./main.go:24:2: live at call to newproc: .autotmp_16 ctx.data ./main.go:29:2: live at call to chanrecv1: .autotmp_16 ./main.go:29:12: live at indirect call: .autotmp_16 ./main.go:31:1: live at indirect call: .autotmp_16 println(db) // println(db) dbが liveでなく なってる