stackoverflow
stackoverflow

Reputation: 19474

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?

Upvotes: 8

Views: 11860

Answers (3)

Thomas
Thomas

Reputation: 5094

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.

Upvotes: 1

Jonathon Faust
Jonathon Faust

Reputation: 12543

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

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

Upvotes: 1

Roger Lindsjö
Roger Lindsjö

Reputation: 11553

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.

Upvotes: 11

Related Questions