当前位置:网站首页>Memory surge problem location
Memory surge problem location
2022-06-09 03:43:00 【seven billion two hundred and fifty-eight million two hundred a】
One 、 Memory related commands
Start a local web service , use jps Command to view the corresponding process .
1. View memory information , The number of instances and the size of occupied memory .
jmap -histo PID > ./log.txt

Open the file as follows
| Field | explain |
|---|---|
| num | Serial number |
| instances | Number of instances |
| bytes | Occupied space size |
| class name | Class name ,[C is a char[],[S is a short[],[I is a int[],[B is a byte[],[[I is a int[][] |

2. View heap information
jmap -heap PID

Heap memory dump
jmap ‐dump:format=b,file=eureka.hprof PID


You can also set memory overflow to automatically export dump file , But pay attention when the memory is large , It may not lead out .
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=./ ( route )
Two 、 Memory surge problem location Demo
test Demo
public class User {
private int id;
private String name;
byte[] a = new byte[1024*100];
public User(){}
public User(int id, String name) {
super();
this.id = id;
this.name = name;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
public class OOMDumpTest {
public static List<Object> list = new ArrayList<>();
public static void main(String[] args) {
List<Object> list = new ArrayList<>();
int i = 0;
int j = 0;
while (true) {
list.add(new User(i++, UUID.randomUUID().toString()));
new User(j--, UUID.randomUUID().toString());
}
}
}
JVM Parameter setting
‐Xms10M ‐Xmx10M ‐XX:+PrintGCDetails ‐XX:+HeapDumpOnOutOfMemoryError ‐XX:HeapDumpPath=D:\test\jvm.dump

The generated jvm.dump File loading jvisualvm Command tool , Through the visual interface, you can see where the problem is .
This article is for study and exchange only , Deletion of infringement contact .
边栏推荐
- 不要提前交卷!!!曾有人在最后35秒,拿到了13分!!!(祝所有考生顺利)...
- After 15000 interns joined Amazon, what was life like in the big factory?
- 内存飙升问题定位
- How to remove carriage return and line feed of text type when exporting data from Informix database
- 免费的视频格式转换器
- 带团队,你的老板“独断专行”吗?(深有感触)
- Final assignment of Web Design - website of XXX company (including navigation bar, rotation chart, etc.)
- 【LeetCode】第48天 - 1037. 有效的回旋镖
- 常量池相关问题解析
- Wwdc2022 interesting news Apple released the free weather API weatherkit
猜你喜欢

National Natural Science Foundation Project query website

初入软件测试职场的朋友看过来,初次编写测试用例的要点

It becomes obsolete when you use it ~websecurityconfigureradapter

JVM内存查看及设置思路

"Baget" takes you one minute to set up your own private nuget server

Neural network learning (IV) -- a simple summary of the knowledge of each layer of neural network

No cached version available for offline mode

JS reverse font reverse crawling, a supplier platform reverse crawling practice

opencv学习笔记一

After 15000 interns joined Amazon, what was life like in the big factory?
随机推荐
Error 1130- host XXX is not allowed to connect to this MariaDB server
Use of rich text boxes
并发操作之——ReentrantReadWriteLock
外网访问局域网方法和VM安装的虚拟机如何在局域网内互相访问
月薪近万,3年销售助理转行测试,0经验的我如何拿到多份offer?
互联网寒冬?软件测试人员如何逆势而行进入高薪大厂
软件测试工程师,要做到什么程度,一个月才能拿1W?
并发操作之——ReenTrantLock和synchronized的区别
Dapr 1.7 UNIX domain socket he's here
HLS 直播协议m3u8详解
Unity first person shooting game, shooting game, with complete functions, can be used as a major assignment or completion
网页设计期末大作业-景点旅游网站(含导航栏,轮播图,样式精美)
如何使用Superset可无缝对接MRS进行自助分析
『C语言』面试管:说下各个字符串函数功能,我:不知道。面试官:小伙子学会了再来面试吧。
解决报错:错误1130- Host xxx is not allowed to connect to this MariaDb server
National Natural Science Foundation Project query website
Handling of missing data in ArcGIS runtime offline GDB
[machinetranslation] a training of multilingual machinetranslation model
New Presto data source support, new symbol map, and release of dataease open source data visual analysis platform v1.11.0
[share] network packet loss fault handling scheme