当前位置:网站首页>Online - GCeasy GC log analysis tools
Online - GCeasy GC log analysis tools
2022-08-01 10:44:00 【elementary school students learning programming】
1.GCeasy
地址:gceasy
2.Simulate pile out of memory
2.1代码引入
jvm配置
-Xms60m -Xmx60m -XX:SurvivorRatio=8 -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+PrintHeapAtGC -Xloggc:D:/Desktop/GCLogTest.log
import java.util.ArrayList;
/** * Test generation detailed log file * * -Xms60m -Xmx60m -XX:SurvivorRatio=8 -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+PrintHeapAtGC */
public class GCLogTest {
public static void main(String[] args) {
ArrayList<byte[]> list = new ArrayList<>();
for (int i = 0; i < 5000; i++) {
byte[] arr = new byte[1024 * 50];//50KB
list.add(arr);
try {
Thread.sleep(30);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
2.2运行代码生成log文件
2.3上传log文件
3.Simulation of yuan space abnormal
3.1代码引入
JVM配置
-Xms60m -Xmx60m -XX:MetaspaceSize=10m -XX:MaxMetaspaceSize=10m -XX:SurvivorRatio=8 -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+PrintHeapAtGC -Xloggc:D:/Desktop/MetaspaceOOM.log
import com.sun.xml.internal.ws.org.objectweb.asm.ClassWriter;
import jdk.internal.org.objectweb.asm.Opcodes;
/** * java.lang.OutOfMemoryError: Metaspace异常演示: * * -Xms60m -Xmx60m -XX:MetaspaceSize=10m -XX:MaxMetaspaceSize=10m -XX:SurvivorRatio=8 -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+PrintHeapAtGC * */
public class MetaspaceOOM extends ClassLoader {
public static void main(String[] args) {
int j = 0;
try {
MetaspaceOOM test = new MetaspaceOOM();
for (int i = 0; i < 10000; i++) {
//创建ClassWriter对象,用于生成类的二进制字节码
ClassWriter classWriter = new ClassWriter(0);
//指明版本号,修饰符,类名,包名,父类,接口
classWriter.visit(Opcodes.V1_8, Opcodes.ACC_PUBLIC, "Class" + i, null, "java/lang/Object", null);
//返回byte[]
byte[] code = classWriter.toByteArray();
//类的加载
test.defineClass("Class" + i, code, 0, code.length);//Class对象
j++;
}
} finally {
System.out.println(j);
}
}
}
3.2运行代码生成log文件
3.3上传log文件
边栏推荐
- .NET性能优化-使用SourceGenerator-Logger记录日志
- 阿里腾讯面试一二
- mysql login in cmd and basic operations of database and table
- Enterprise WeChat group: robot timing reminder function database configuration
- Batch大小不一定是2的n次幂!ML资深学者最新结论
- 图解MySQL内连接、外连接、左连接、右连接、全连接......太多了
- C#/VB.NET 将PPT或PPTX转换为图像
- 利用正则表达式的回溯实现绕过
- 基于CAP组件实现补偿事务与消息幂等性
- Promise learning (1) What is Promise?how to use?How to solve callback hell?
猜你喜欢
随机推荐
How to find out hidden computer software (how to clean up the computer software hidden)
Push the local project to the remote repository
Browser shortcut keys
For small applications, which database is better to use?
Promise学习(一)Promise是什么?怎么用?回调地狱怎么解决?
小程序毕设作品之微信美食菜谱小程序毕业设计成品(1)开发概要
Qt 支持HEIC/HEIF格式图片
JWT
MacOS下postgresql(pgsql)数据库密码为什么不需要填写或可以乱填写
xss-labs靶场挑战
机器学习 | MATLAB实现支持向量机回归RegressionSVM参数设定
MFC实现交通图导航系统
跨域网络资源文件下载
力扣解法汇总1374-生成每种字符都是奇数个的字符串
7/31 训练日志
Endorsed in 2022 years inventory | product base, science and technology, guangzhou automobile group striding forward
一篇文章,带你详细了解华为认证体系证书(2)
关于#SQL#的问题,如何解决?
Small application project works WeChat gourmet recipes applet graduation design of finished product (1) the development profile
Mysql index related knowledge review one