Can we suggest to the GC that I think this memory can be reclaimed?

226 views
Skip to first unread message

kun Yugawa

unread,
Sep 14, 2024, 11:00:52 AM9/14/24
to golang-nuts
I think this is in line with the philosophy of Go, a balance between Python and C++, a balance between GC and manually managing memory.

Frederik Zipp

unread,
Sep 14, 2024, 12:55:49 PM9/14/24
to golang-nuts
Yes, by no longer holding a reference to it. If an object is no longer referenced, it becomes a candidate for garbage collection.

Kevin Chowski

unread,
Sep 16, 2024, 11:47:23 AM9/16/24
to golang-nuts
In particular, since Go has a goal of avoiding use-after-free bugs, the GC would have to do the same validation it is doing anyway to double-check that the caller is not wrong.

Robert Engels

unread,
Sep 16, 2024, 11:51:26 AM9/16/24
to Kevin Chowski, golang-nuts
With Go there is no possibility of use after free unless you use unsafe calls. 

On Sep 16, 2024, at 10:47 AM, Kevin Chowski <Ke...@chowski.com> wrote:

In particular, since Go has a goal of avoiding use-after-free bugs, the GC would have to do the same validation it is doing anyway to double-check that the caller is not wrong.

On Saturday, September 14, 2024 at 10:55:49 AM UTC-6 Frederik Zipp wrote:
Yes, by no longer holding a reference to it. If an object is no longer referenced, it becomes a candidate for garbage collection.

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/20d2db53-fa13-44e3-9e8f-a545078e85b8n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages