当前位置:网站首页>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文件
边栏推荐
猜你喜欢
石头科技打造硬核品牌力 持续出海拓展全球市场
图解MySQL内连接、外连接、左连接、右连接、全连接......太多了
MySQL 必现之死锁
MacOS下postgresql(pgsql)数据库密码为什么不需要填写或可以乱填写
PowerPC技术与市场杂谈
Google Earth Engine APP——15行代码搞定一个inspector高程监测APP
What's up with VS "Cannot find or open PDB file"?How to solve
小程序毕设作品之微信美食菜谱小程序毕业设计成品(3)后台功能
Solve vscode input! Unable to quickly generate skeletons (three methods for the new version of vscode to quickly generate skeletons)
[Software Architecture Mode] The difference between MVVM mode and MVC mode
随机推荐
Mysql index related knowledge review one
使用KeyStore生成证书
STM32入门开发 介绍IIC总线、读写AT24C02(EEPROM)(采用模拟时序)
Dapr 与 NestJs ,实战编写一个 Pub & Sub 装饰器
什么是步进电机?40张图带你了解!
4种常见的鉴权方式及说明
CTFshow,命令执行:web31
Introduction and application of pointers
shell--面试题
解决new Thread().Start导致高并发CPU 100%的问题
还在纠结报表工具的选型么?来看看这个
开天aPaaS之移动手机号码空号检测【开天aPaaS大作战】
URL.createObjectURL、URL.revokeObjectURL、Uint8Array、Blob使用详解
WPF 截图控件之绘制箭头(五)「仿微信」
编码解码(btoa、encodeURIComponent、encodeURI、escape)
MacOS下postgresql(pgsql)数据库密码为什么不需要填写或可以乱填写
Promise学习(四)异步编程的终极解决方案async + await:用同步的方式去写异步代码
玻璃拟态(Glassmorphism)设计风格
Dataset之mpg:mpg数据集的简介、下载、使用方法之详细攻略
redis