当前位置:网站首页>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文件
边栏推荐
猜你喜欢
Batch大小不一定是2的n次幂!ML资深学者最新结论
ClickHouse入门介绍与其特性
什么是步进电机?40张图带你了解!
Mini Program Graduation Works WeChat Food Recipes Mini Program Graduation Design Finished Products (4) Opening Report
WTM:ASP.NET Core快速开发利器!
冰冰学习笔记:gcc、gdb等工具的使用
利用正则表达式的回溯实现绕过
What's up with VS "Cannot find or open PDB file"?How to solve
Small application project works WeChat gourmet recipes applet graduation design of finished product (1) the development profile
retired paddling
随机推荐
AI篮球裁判火了,走步算得特别准,就问哈登慌不慌
ModelArts-based object detection YOLOv3 practice [play with HUAWEI CLOUD]
跨域网络资源文件下载
使用KeyStore生成证书
[Cloud Residency Co-Creation] Huawei Cloud Global Scheduling Technology and Practice of Distributed Technology
石头科技打造硬核品牌力 持续出海拓展全球市场
MySQL常用语句总结
监视网络连接的ss命令
PowerPC技术与市场杂谈
回归预测 | MATLAB实现TPA-LSTM(时间注意力注意力机制长短期记忆神经网络)多输入单输出
从零开始Blazor Server(4)--登录系统
一文说明白ECDSA spec256k1 spec256r1 EdDSA ed25519千丝万缕的关系
正则表达式
回归预测 | MATLAB实现RNN循环神经网络多输入单输出数据预测
记一次 .NET 某智慧物流WCS系统CPU爆高分析
WTM:ASP.NET Core快速开发利器!
Introduction and application of pointers
使用ESP32驱动QMA7981读取三轴加速度(带例程)
CTFshow,命令执行:web37
Go-Excelize API source code reading (8) - GroupSheets(sheets []string), UngroupSheets()