garbage collection and indy
Charles Oliver Nutter
headius at headius.com
Tue Aug 22 20:38:51 UTC 2023
On Tue, Aug 22, 2023 at 3:07 PM Jochen Theodorou <blackdrag at gmx.org> wrote:
> Is there any possible circumstance in which the class Foo can now be
> garbage collected? My assumption is no.
I can't speak to varhandles but this is very much like how JRuby
handles all of our jitted Ruby methods and indy binding. Under normal
circumstances, most Ruby methods get jit-compiled to bytecode lazily
and loaded into a unique classloader each; that classloader is not
rooted anywhere, so that if the Ruby method goes away, the jitted
class can also go away.
If the method was transient in the Ruby world (e.g. created on a
"singleton" object that goes out of scope) but is still bound at a
call site, it will not get garbage collected. We've actually had some
"won't fix" bug reports about indy call sites rooting methods or
classes that were called once (as is our expectation, not a bug).
- Charlie
More information about the mlvm-dev
mailing list