How to determine cause of class loading

Doug Simon doug.simon at
Thu Dec 14 13:39:38 UTC 2017

That's enough input for me to open an issue ;-)


> On 14 Dec 2017, at 14:30, Alan Bateman <Alan.Bateman at> wrote:
> On 14/12/2017 13:20, Doug Simon wrote:
>> Quite often I find myself wanting to know why a given class is loaded. That is, I want to see a stack trace. As far as I can tell, there is no support for this in HotSpot which is why we hacked in support for a -XX:+TraceClassLoadingStack to graal-jvmci-8[1]. Is there a good reason a similar flag should not be added to main line HotSpot?
> I've needed to do this a few times, I've usually resorted to adding an initializer to the class to dump the stack when it runs.
> If something like this is added then it could be useful to specify a pattern or even a list class names to avoid a stack trace for every class. That might help with interference too when there is a lot of class loading going on in different threads.
> -Alan

More information about the hotspot-dev mailing list