func main() {
for i := 0; i < 10000000; i++ {
func() {
data := new(int)
*data = 100
runtime.SetFinalizer(data, func(data *int) {
fmt.Println("结束了", *data)
})
}()
}
time.Sleep(time.Second)
fmt.Println("over")
}
runtime.SetFinalizer
于 2022-01-14 18:38:19 首次发布