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

3

8

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?

Photosphere answered 9/12, 2011 at 18:23 Comment(0)
W
11

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.

Wingding answered 9/12, 2011 at 18:35 Comment(1)
@KaizenSoze Did you mean jhat? I mentioned jmap, but maybe you think I should add info about it?Willock
F
1

Ctrl+Break will produce a thread dump and various statistics.

This is documented, along with kill -QUIT, here.

Fogarty answered 9/12, 2011 at 18:27 Comment(0)
P
1

Look into the official debugger, jdb. You have to run your java program with a certain flag, but then you should be able to look at a bunch of stuff from the commandline.

Pump answered 9/12, 2011 at 18:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.