RFR: 6246: Making the agent stop using Unsafe

Marcus Hirt hirt at openjdk.java.net
Sun Jan 19 11:35:17 UTC 2020

On Fri, 17 Jan 2020 20:10:37 GMT, Kangcheng Xu <kxu at openjdk.org> wrote:

>> Doesn't this affect in which class loader the event classes are defined, and especially their unload behaviour?
> In the case of reflective access, it's called directly on the system class loader. For `Lookup.defineClass`, the event class is defined on the class loader of the lookup, which in this case is the system class loader that loads `org.openjdk.jmc.agent.generated_events.Dummy`.
> In both cases, events are defined with the system class loader, just like `Unsafe.defineClass`.

I was under the impression that the class loader and protection domain arguments given to define class would define the class with that class loader and protection domain, allowing the event class to be unloaded when the class where it is being used is unloaded. If this is not done, we’re basically introducing a class leak.


PR: https://git.openjdk.java.net/jmc/pull/35

More information about the jmc-dev mailing list