当前位置:网站首页>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文件
边栏推荐
- 利用正则表达式的回溯实现绕过
- 小程序毕设作品之微信美食菜谱小程序毕业设计成品(4)开题报告
- mysql login in cmd and basic operations of database and table
- 2022年7月31日--使用C#迈出第一步--使用C#中的数组和foreach语句来存储和循环访问数据序列
- Guangyu Mingdao was selected into the list of pilot demonstration projects for the development of digital economy industry in Chongqing in 2022
- 图解MySQL内连接、外连接、左连接、右连接、全连接......太多了
- URL.createObjectURL、URL.revokeObjectURL、Uint8Array、Blob使用详解
- Qt supports HEIC/HEIF format images
- JWT
- xss-labs靶场挑战
猜你喜欢
Solve vscode input! Unable to quickly generate skeletons (three methods for the new version of vscode to quickly generate skeletons)
世界第4疯狂的科学家,在103岁生日那天去世了
The meaning and trigger conditions of gc
WPF 截图控件之绘制箭头(五)「仿微信」
What's up with VS "Cannot find or open PDB file"?How to solve
冰冰学习笔记:gcc、gdb等工具的使用
Custom Types - Enums, Unions
Dapr 与 NestJs ,实战编写一个 Pub & Sub 装饰器
.NET深入解析LINQ框架(三:LINQ优雅的前奏)
Small application project works WeChat gourmet recipes applet graduation design of finished product (1) the development profile
随机推荐
Basic configuration commands of cisco switches (what is the save command of Huawei switches)
What is a stepper motor?40 pictures to show you!
Promise learning (1) What is Promise?how to use?How to solve callback hell?
Guangyu Mingdao was selected into the list of pilot demonstration projects for the development of digital economy industry in Chongqing in 2022
Mini Program Graduation Works WeChat Food Recipes Mini Program Graduation Design Finished Products (2) Mini Program Functions
What's up with VS "Cannot find or open PDB file"?How to solve
机器学习 | MATLAB实现支持向量机回归RegressionSVM参数设定
Android 安全与防护策略
【云驻共创】分布式技术之华为云全域调度技术与实践
Custom Types - Enums, Unions
广域铭岛入选2022年重庆市数字经济产业发展试点示范项目名单
EasyRecovery热门免费数据检测修复软件
mysql login in cmd and basic operations of database and table
这是我见过写得最烂的Controller层代码,没有之一!
开天aPaaS之移动手机号码空号检测【开天aPaaS大作战】
正则表达式
Small application project works WeChat gourmet recipes applet graduation design of finished product (1) the development profile
How to find out hidden computer software (how to clean up the computer software hidden)
LeakCanary如何监听Service、Root View销毁时机?
Golang内存分析工具gctrace和pprof实战