当前位置:网站首页>Visual VM 定位OOM,FullGC使用方法
Visual VM 定位OOM,FullGC使用方法
2022-07-26 17:33:00 【#小苏打】
Visual VM 是一个JVM虚拟机可视化的工具,在JDK1.7以后自带
主要用于开发人员 排除错误,观察堆栈使用情况
它的路径在JDK的bin路径下,双击打开

打开结果如下

总结一下定位OOM,FullGC使用方法大概步骤
- 设置JVM参数,打印日志
- 获取dump文件
- 通过VisualVM分析dump文件
- 修改代码验证
下面我们来模拟一次OOM
public class OOM {
public static void main(String[] args) {
ArrayList<Object> list = new ArrayList<>();
while (true){
list.add(new Random().nextInt());
}
}
}内存溢出代码

-Xmx1024m
-Xms1024m
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=d:\dump //设置存储文件地址
设置堆转存储的位置
(这里堆转存储的意思大概是堆满了,将未完成的结果以文件的形式存储起来)

打印的错误信息


打开Java VisualVM加载文件
可以确定到是 main 线程造成了OOM(定位线程)

点击进入,可以查看到是那段代码出现了问题(定位代码段)
边栏推荐
- [static code quality analysis tool] Shanghai daoning brings you sonarource/sonarqube download, trial and tutorial
- 8.2 some algebraic knowledge (groups, cyclic groups and subgroups)
- 2022河南萌新联赛第(三)场:河南大学
- 8、 Topic communication: topic substitution and monitoring
- 打印日志的一些小技巧
- DTS is equipped with a new self-developed kernel, which breaks through the key technology of the three center architecture of the two places Tencent cloud database
- 跟我学 UML 系统建模
- 2022 Henan Mengxin League game (3): Henan University
- 十年架构五年生活-06 离职的冲动
- 1、 Header file, output format,::, namespace
猜你喜欢

ssm练习第三天_分页助手_安全框架

Relative path and absolute path

Vector CANape - How to Send Receive CAN Message in CANape

Privacy computing basic component series - confusion circuit

剑指offer 正则表达式匹配

菜鸟 CPaaS 平台微服务治理实践

During the oppo interview, 16 questions were thrown over. I was stupid

ssm练习第二天_项目拆分moudle_基本增删改查_批量删除_一对一级联查询

2020美亚个人赛复盘

【Unity3D】摇杆
随机推荐
During the oppo interview, 16 questions were thrown over. I was stupid
Oracle第一天(开发常用的知识点再回顾整理下)
钉钉第三方服务商应用ISV应用开发及上架教程
Greedy - 455. Distribute cookies
6、 Common commands of ROS (I): rosnode, rostopic, rosmsg
Win10 连接无线不能输入密码字符,一输入就卡死
1、 Header file, output format,::, namespace
俄语翻译的就业前景怎样 如何做好俄语翻译工作
.Net CLR GC 动态加载短暂堆阈值的计算及阈值超量的计算
LeetCode 0137. 只出现一次的数字 II
Leetcode 0137. number II that appears only once
How to assemble a registry
ICML 2022 (Part 4) | | graph hierarchical alignment graph kernel to realize graph matching
[static code quality analysis tool] Shanghai daoning brings you sonarource/sonarqube download, trial and tutorial
如何组装一个注册中心
【Unity3D】摇杆
我要开中信的证券账户找渠道的经理开安全吗?
Linux Installation mysql8.0.29 detailed tutorial
[Digital IC] understand Axi Lite protocol in simple terms
[a little knowledge] thread pool