Java debug tools. Jstack, jmap and jhat.

waldyrious/alt-syntax
Peter Tripp 2016-02-16 11:27:52 -08:00
parent 8991253b8d
commit 67e2c723af
3 changed files with 45 additions and 0 deletions

11
pages/common/jhat.md Normal file
View File

@ -0,0 +1,11 @@
# jhat
> Java Heap Analysis Tool.
- Analyze a heap dump (from jmap), view via http on port 7000:
`jhat {{dump_file.bin}}`
- Analyze a heap dump, specifying an alternate port for the http server:
`jhat -p {{port}} {{dump_file.bin}}`

19
pages/common/jmap.md Normal file
View File

@ -0,0 +1,19 @@
# jmap
> Java Memory Map Tool.
- Print shared object mappings for a java process (output like pmap):
`jmap {{java_pid}}`
- Print heap summary information:
`java -heap {{filename.jar}} {{java_pid}}`
- Print histogram of heap usage by type:
`jmap -histo {{java_pid}}`
- Dump contents of the heap into a binary file for analysis with jhat:
`jmap -dump:format=b,file={{filename}} {{java_pid}}`

15
pages/common/jstack.md Normal file
View File

@ -0,0 +1,15 @@
# jstack
> Java Stack Trace Tool.
- Print java stack traces for all threads in a java process:
`jstack {{java_pid}}`
- Print mixed mode (java/c++) stack traces for all threads in a java process:
`jstack {{java_pid}}`
- Print stack traces from java core dump:
`jstack {{/usr/bin/java}} {{file.core}}`