Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: SetFinalizer documentation ambiguous or confusing #24480

seebs opened this issue Mar 21, 2018 · 2 comments


None yet
4 participants
Copy link

commented Mar 21, 2018

What version of Go are you using (go version)?


Does this issue reproduce with the latest release?


What operating system and processor architecture are you using (go env)?

N/A; this is a documentation bug.

What did you do?

Read the documentation.

What did you expect to see?

Something clearer.

What did you see instead?

The documentation for runtime.SetFinalizer says:

The finalizer for obj is scheduled to run at some arbitrary time after obj becomes unreachable.

The text as a whole strongly suggests that the meaning is "at some arbitrary time after the object pointed to by obj becomes unreachable".


p := &something
q := p
runtime.SetFinalizer(q, ...)
// can the finalizer be invoked here, as q is now unreachable?

Consensus among some devs is that the answer is probably "no", but the actual words used appear to state that, since obj (q) is unreachable, the finalizer can run.


This comment has been minimized.

Copy link

commented Mar 22, 2018

(CC: @aclements, @RLH for GC terminology)

@bcmills bcmills added this to the Go1.11 milestone Mar 22, 2018

@ALTree ALTree changed the title SetFinalizer documentation ambiguous or confusing runtime: SetFinalizer documentation ambiguous or confusing Mar 22, 2018


This comment has been minimized.

Copy link

commented Jul 7, 2018

Change mentions this issue: runtime: clarify SetFinalizer docs

@gopherbot gopherbot closed this in fb59bcc Jul 9, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.