Assume i'm executing a jvm where garbage collection is not running in parallel. That is when GC executes my main thread is halted.
Is there a way in which i can specify what method was running that current moment that the GC was invoked? I know i can get info about time but this is not enough. I assume such profiling info would be easy for the JVM to provide as it would only just be a matter of returning the top most element (stack frame) of each stack of a halted thread.
thanks.
I figure you want to make sure that garbage collection should not affect your benchmarking. Some ideas:
Generally no. If you can then it is a vendor specific extension.
Question is, why you want to know?
If you gave acces to JMX you can see memory consumption and where there is spike there is also a garbage collection.
It's not precise as to see what method was running, but from the top of the stack you could allways get String.equals() and know nothingt.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.