我是靠谱客的博主 忧心黑猫,最近开发中收集的这篇文章主要介绍java虚拟机系列:jhat虚拟机堆栈转存快照分析工具,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

###用法

jhat -h    
Usage:  jhat [-stack <bool>] [-refs <bool>] [-port <port>] [-baseline <file>] [-debug <int>] [-version] [-h|-help] <file>

	-J<flag>          Pass <flag> directly to the runtime system. For
			  example, -J-mx512m to use a maximum heap size of 512MB
			  通过 -J 可以在启动JVM时传入一些启动参数. 例如, -J-Xmx512m 则指定运行 jhat 的Java虚拟机使用的最大堆内存为 512 MB. 
	-stack false:     Turn off tracking object allocation call stack.
			关闭对象分配调用栈跟踪(tracking object allocation call stack)。 如果分配位置信息在堆转储中不可用. 则必须将此标志设    置为 false. 默认值为 true.
	-refs false:      Turn off tracking of references to objects
	关闭对象引用跟踪(tracking of references to objects)。 默认值为 true. 默认情况下, 返回的指针是指向其他特定对象的对象,如反向链接或输入引用(referrers or incoming references), 会统计/计算堆中的所有对象。
	-port <port>:     Set the port for the HTTP server.  Defaults to 7000
	设置 jhat HTTP server 的端口号. 默认值 7000.
	-exclude <file>:  Specify a file that lists data members that should
			  be excluded from the reachableFrom query.
			  指定对象查询时需要排除的数据成员列表文件(a file that lists data members that should be excluded from the reachable objects query)。 例如, 如果文件列列出了 java.lang.String.value , 那么当从某个特定对象 Object o 计算可达的对象列表时, 引用路径涉及 java.lang.String.value 的都会被排除。
	-baseline <file>: Specify a baseline object dump.  Objects in
			  both heap dumps with the same ID and same class will
			  be marked as not being "new".
			  指定一个基准堆转储(baseline heap dump)。 在两个 heap dumps 中有相同 object ID 的对象会被标记为不是新的(marked as not being new). 其他对象被标记为新的(new). 在比较两个不同的堆转储时很有用.
	-debug <int>:     Set debug level.
			    0:  No debug output
			    1:  Debug hprof file parsing
			    2:  Debug hprof file parsing, no server
	-version          Report version number
	-h|-help          Print this help and exit
	<file>            The file to read

For a dump file that contains multiple heap dumps,
you may specify which dump in the file
by appending "#<number>" to the file name, i.e. "foo.hprof#3".

All boolean options default to "true"

###用法

[@82995c215909 ~]$ jhat /tmp/text
Reading from /tmp/text…
Dump file created Tue Jul 24 20:36:09 CST 2018
Snapshot read, resolving…
Resolving 739416 objects…
Chasing references, expect 147 dots…
Eliminating duplicate references…
Snapshot resolved.
Started HTTP server on port 7000
Server is ready.

访问web
这里写图片描述

  1. All classes including platform:显示堆栈的所有类
  2. Show all members of the rootset:从根集能引用到的对象
  3. Show instance counts for all classes (including platform):显示平台包括的所有类的实例数量
  4. Show instance counts for all classes (excluding platform):平台外的所有对象信息
  5. Show heap histogram:堆实例的分布表
  6. Show finalizer summary:Finalizer队列对待的实例
  7. Execute Object Query Language (OQL) query:执行对象查询语句

参考:
https://www.cnblogs.com/baihuitestsoftware/articles/6406271.html

最后

以上就是忧心黑猫为你收集整理的java虚拟机系列:jhat虚拟机堆栈转存快照分析工具的全部内容,希望文章能够帮你解决java虚拟机系列:jhat虚拟机堆栈转存快照分析工具所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(48)

评论列表共有 0 条评论

立即
投稿
返回
顶部