Dan Dan - 3 months ago 9
Java Question

Display the JVM's ThreadStackSize during the execution of an application

I need to debug an application that sometimes produces a StackOverflow exception. This only occurs sometimes, and I do not know where is the problem because the exception is thrown in a thread that is always refreshing a picture, so there is no way to see the full stack trace.

In order to reproduce the error each time I run the application (instead of need to execute it several times until the error suddenly occurs) I want to reduce the JVM's ThreadStackSize. I know how to do this, but what I would like to do is to display the current JVM's thread stack size through the console to be sure that the change is effective.

So, my question is: Does Java provide any mechanism to display the mentioned information during the execution of a specific app?

Answer

display the current JVM's thread stack size through the console

jinfo -flag ThreadStackSize PID