Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I view memory usage, thread dump for java programs, from command line?

Is there any known command line tool to ask the JVM to see memory usage and thread dumps of a java program. something like a headless jvisualvm?

like image 331
stackoverflow Avatar asked Dec 09 '11 18:12

stackoverflow


People also ask

How do I view thread dumps?

To find the long running threads, highlight all the thread dumps you want to check, and then click on the binoculars: In the pop up dialogue, click start detection, and you'll get your long running threads just below the dumps themselves: In my example, each thread dump has 157 threads.

What is Jstack command?

The jstack command prints Java stack traces of Java threads for a specified Java process. For each Java frame, the full class name, method name, byte code index (BCI), and line number, when available, are printed.


1 Answers

You can use jstat to get gc information, jstack to get stack traces and jmap to get memory statistics and memory dumps for off-line inspection.

like image 107
Roger Lindsjö Avatar answered Sep 30 '22 17:09

Roger Lindsjö