本文介绍了如何跟踪在jvm中加载和销毁类的时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在jvm中加载和销毁类时跟踪?是否有jvm公开的回调方法?
How do I keep track when class is loaded and destroyed in jvm? Is there any callback method that is exposed by the jvm?
推荐答案
如果你使用的是Sun / Oracle JVM,你可以使用 TraceClassLoading
和 TraceClassUnloading
选项。使用以下命令查看JVM支持的选项:
If you're using a Sun/Oracle JVM, you could use the TraceClassLoading
and TraceClassUnloading
options. Use the following to see what options your JVM supports:
java -XX:+AggressiveOpts -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+PrintFlagsFinal -version
如果支持这些选项,请使用<$运行Java应用程序c $ c> -XX:+ TraceClassLoading -XX:+ TraceClassUnloading 。您应该看到以下消息:
If these options are supported, run your Java application using -XX:+TraceClassLoading -XX:+TraceClassUnloading
. You should see messages like:
[Loaded ... from ...]
[Unloading class ...]
这篇关于如何跟踪在jvm中加载和销毁类的时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!