On Wed, Sep 22, 2021 at 1:22 AM Cholerae Hu <cholerae...@gmail.com> wrote: > > https://play.golang.org/p/WJTH-lUukeb > > Do I need to uncomment line 23? IMHO, variable data and ds will not be used > after line 16, so they can be collected in runtime.GC. But running it with > gccheckmark=1 and clobberfree=1 doesn't show any problems. > > Are there any documents about the details or behavior of liveness analysis?
I don't see any reason why that program should need runtime.KeepAlive. The local variable sh will point to data (aka ds), so the object will stay alive. This is not different than p := &data. After that point, if data is no longer mentioned, then the variable data is no longer live, but the value that p points to will remain alive. Ian -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcWc4zteeRHmXPNqy7hUtFUxE3DrNFww5_yUwXebvH0Dpg%40mail.gmail.com.