How to determine cause of class loading
Alan.Bateman at oracle.com
Thu Dec 14 13:30:08 UTC 2017
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. 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.
More information about the hotspot-dev