ModuleLayer.Controller strongly references Module
Alan Bateman
Alan.Bateman at oracle.com
Wed Nov 24 12:33:24 UTC 2021
On 24/11/2021 12:19, Michał Kłeczek wrote:
> Hi Alan,
>
> (Disregard previous message - fat fingers)
>
> Attached is a first draft of the patch:
>
> 1. Controller is created upon ML construction and returned from static
> ML.defineModules methods.
> 2. Created two controller liveness tests (they rely on System.gc()
> though - not sure if there are some tricks to test it reliably).
I read your mail about "smart proxy" classes and lazy downloading of
modules. I don't have an opinion at this time on whether this is worth
doing or not.
If you want to experiment with patches then add a volatile field to ML
and only set it when VM.isBooted() is true. In order words, let the
ML.Controller for the boot layer be GC'ed as it is now (it would be
attractive nuisance to keep it alive). There are many tests in the
test/jdk tree that check that a weak ref is cleared, there is also some
test infrastructure to help, so you might want to look at those.
-Alan
More information about the jigsaw-dev
mailing list