当前位置:网站首页>在线GC日志分析工具——GCeasy
在线GC日志分析工具——GCeasy
2022-08-01 10:19:00 【正在学习编程的小学生】
1.GCeasy
地址:gceasy
2.模拟堆内存不足
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;
/** * 测试生成详细的日志文件 * * -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.模拟元空间异常
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 login in cmd and basic operations of database and table
- The first experience of Shengsi large model experience platform——Take the small model LeNet as an example
- CTFshow,命令执行:web37
- STM32 Personal Notes - Embedded C Language Optimization
- How programmers learn open source projects, this article tells you
- MFC implementation road map navigation system
- 报告:想学AI的学生数量已涨200%,老师都不够用了
- IntellJ IDEA如何显示换行符(line endings)
- Introduction to STM32 development Introduce IIC bus, read and write AT24C02 (EEPROM) (using analog timing)
- How to implement deep copy in js?
猜你喜欢

Shell: Conditional test action

What is a stepper motor?40 pictures to show you!

招聘随想2022

【钛晨报】国家统计局:7月制造业PMI为49%;玖富旗下理财产品涉嫌欺诈,涉及390亿元;国内航线机票燃油附加费8月5日0时起下调

小程序毕设作品之微信美食菜谱小程序毕业设计成品(3)后台功能

Comprehensive experiment BGP

使用ESP32驱动QMA7981读取三轴加速度(带例程)

The use of scrapy crawler framework

Py之yellowbrick:yellowbrick的简介、安装、使用方法之详细攻略

rpm and yum
随机推荐
Drawing arrows of WPF screenshot control (5) "Imitation WeChat"
正则表达式
微信公众号授权登录后报redirect_uri参数错误的问题
Visualization - Superset installation and deployment
C语言程序设计50例(三)(经典收藏)
关于#SQL#的问题,如何解决?
如何在IntellJ IDEA中批量修改文件换行符
Node's traditional and advanced practices for formatting time (moment)
PDMan-domestic free general database modeling tool (minimalist, beautiful)
URL.createObjectURL、URL.revokeObjectURL、Uint8Array、Blob使用详解
小程序毕设作品之微信美食菜谱小程序毕业设计成品(1)开发概要
【钛晨报】国家统计局:7月制造业PMI为49%;玖富旗下理财产品涉嫌欺诈,涉及390亿元;国内航线机票燃油附加费8月5日0时起下调
RK3399平台开发系列讲解(内核入门篇)1.52、printk函数分析 - 其函数调用时候会关闭中断
notes....
什么是步进电机?40张图带你了解!
How to Steal $100 Million from the Perfect Smart Contract
redis
Guangyu Mingdao was selected into the list of pilot demonstration projects for the development of digital economy industry in Chongqing in 2022
For small applications, which database is better to use?
开天aPaaS之移动手机号码空号检测【开天aPaaS大作战】