You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 4, 2023. It is now read-only.
This allows Ruby code to listen directly for when V8 object is garbage
collected. This is done with the `__DefineFinalizer__` method which can
be invoked on any handle. E.g.
v8_object.__DefineFinalizer__(method_that_generates_callable)
Just like in Ruby, care should be taken to ensure that the finalizer
does not reference the V8 object at all, otherwise, it might prevent it
from being garbage collected. The later, once v8_object has been gc'd,
the finalizer will be enqueued into an internal data structure that can
be accessed via the isolate's `__EachV8Finalizer`
isolate.__EachV8Finalizer__ do |finalizer|
finalizer.call()
end
There was a question of whether to follow the strict V8 API for this,
and expose the `SetWeak` method, but this would mean actually making a
handle weak, which is fine, but then we would have to add a mechanism
to capture a strong reference from any reference which we don't have.
We may want to revisit this at some later date.
0 commit comments