On Tue, Feb 24, 2026 at 5:41 AM 'Qingwei Li' via golang-nuts <[email protected]> wrote: > > Sorry for the late reply and thank you all for your replies. > I think I should loosen the requirements for my question without introducing > the concept of ownership. > > Does setting c to nil in "move" function helps GC sweep the connection object > pointed by c and c2 soon if G1 keeps long but does not use connection object, > G2 finishes soon and the c pointer does not exist in temporary locations, > slots that can hold pointers, or registers? The program in original post in > pasted here:
While things can vary, in general, no, setting c to nil won't make any difference. The compiler keeps track of when variables are live, and the GC ignores variables that are not live. 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 [email protected]. To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcVVAgnTVdSW7teJerMpQpUO59Jd8ZaOD4yHFgA6z3UaQg%40mail.gmail.com.
