LiveObj is not garbage collected while it has running goroutine associated
with it, or it is just coincidence?
Thank you.
`package main
import "fmt"
import "time"
import "runtime"
type LiveObj struct {
}
func (self *LiveObj) run() {
for {
time.Sleep(1 * time.Second)
fmt.Println("Hello, LiveObj")
}
}
func main() {
fmt.Println("Hello, playground")
{
l := &LiveObj{}
go l.run()
}
runtime.GC()
time.Sleep(1 * time.Minute)
}`
Output:
`Hello, playgroundHello, LiveObjHello, LiveObj.... (for 1 minute)
Program exited.`
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.