当前位置:网站首页>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文件

边栏推荐
- 正则表达式
- STM32 personal notes - program run and fly
- 小程序毕设作品之微信美食菜谱小程序毕业设计成品(1)开发概要
- 监视网络连接的ss命令
- Taobao commodity details and details on taobao, senior upgrade version of the API
- ClickHouse多种安装方式
- Mini Program Graduation Works WeChat Food Recipes Mini Program Graduation Design Finished Products (2) Mini Program Functions
- 2022年7月31日--使用C#迈出第一步--使用C#中的数组和foreach语句来存储和循环访问数据序列
- July 31, 2022 -- Take your first steps with C# -- Use C# to create readable code with conventions, spaces, and comments
- .NET深入解析LINQ框架(三:LINQ优雅的前奏)
猜你喜欢

回归预测 | MATLAB实现TPA-LSTM(时间注意力注意力机制长短期记忆神经网络)多输入单输出

What is a stepper motor?40 pictures to show you!
![[Software Architecture Mode] The difference between MVVM mode and MVC mode](/img/37/8470ff9267752d4ca26a6b54ec0b50.png)
[Software Architecture Mode] The difference between MVVM mode and MVC mode

各位大拿,安装Solaris 11.4操作系统,在安装数据库依赖包的时候包这个错,目前无原厂支持,也无安装盘,联网下载后报这个错,请教怎么解决?

.NET性能优化-使用SourceGenerator-Logger记录日志

.NET深入解析LINQ框架(三:LINQ优雅的前奏)

小程序毕设作品之微信美食菜谱小程序毕业设计成品(1)开发概要

CTO strongly banning the use of the Calendar, that in what?

进制与转换、关键字

What's up with VS "Cannot find or open PDB file"?How to solve
随机推荐
MacOS下postgresql(pgsql)数据库密码为什么不需要填写或可以乱填写
CTFshow,命令执行:web33
使用ESP32驱动QMA7981读取三轴加速度(带例程)
2022年中盘点 | 产品打底,科技背书,广汽集团阔步向前
redis
进制与转换、关键字
Qt 支持HEIC/HEIF格式图片
关于#SQL#的问题,如何解决?
DBPack SQL Tracing 功能及数据加密功能详解
小程序毕设作品之微信美食菜谱小程序毕业设计成品(1)开发概要
[Cloud Residency Co-Creation] Huawei Cloud Global Scheduling Technology and Practice of Distributed Technology
力扣解法汇总1374-生成每种字符都是奇数个的字符串
MFC实现交通图导航系统
Mini Program Graduation Works WeChat Food Recipes Mini Program Graduation Design Finished Products (3) Background Functions
Message queue interview latest finishing (2022)
MTK6225-紧急电话
JWT
InputStream转成String
CTFshow,命令执行:web31
C#/VB.NET convert PPT or PPTX to image