JDK 的命令列工具
阿新 • • 發佈:2018-12-02
一、jps 查詢正在執行的虛擬機器程序。
-m
輸出虛擬機器程序啟動時傳遞給main()函式的引數
-l
輸出程序執行的主類的全名
-v
輸出虛擬機器程序啟動時的JVM引數
二、jinfo 檢視虛擬機器配置引數資訊
三、jstack 生成java虛擬機器當前時刻的執行緒快照
-F:當正常輸出請求不被響應時,強制輸出執行緒棧堆。
-l:顯示關於鎖的附加資訊。
-m:顯示本地方法棧
四、jmap 生成虛擬機器記憶體轉儲快照
Usage: jmap [option] <pid> (to connect to running process) jmap [option] <executable <core> (to connect to a core file) jmap [option] [
[email protected]]<remote server IP or hostname> (to connect to remote debug server) where <option> is one of: <none> to print same info as Solaris pmap -heap to print java heap summary -histo[:live] to print histogram of java object heap; if the "live" suboption is specified, only count live objects -clstats to print class loader statistics -finalizerinfo to print information on objects awaiting finalization -dump:<dump-options> to dump java heap in hprof binary format dump-options: live dump only live objects; if not specified, all objects in the heap are dumped. format=b binary format file=<file> dump heap to <file> Example: jmap -dump:live,format=b,file=heap.bin <pid> -F force. Use with -dump:<dump-options> <pid> or -histo to force a heap dump or histogram when <pid> does not respond. The "live" suboption is not supported in this mode. -h | -help to print this help message -J<flag> to pass <flag> directly to the runtime system
五、jhat 分析 Jmap 產生的堆複製檔案
jhat -J-Xmx512m heap.dmp