From e418b36dbdde496756cdf5c1bb4283fdb5c38528 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=A9=AC=E5=BA=9C=E5=BC=BA?=
<8569561+fuqiangma@user.noreply.gitee.com>
Date: Sun, 15 Jan 2023 14:35:14 +0800
Subject: [PATCH] oomtest
---
oomdemo/.idea/.gitignore | 8 +++++
oomdemo/.idea/compiler.xml | 13 ++++++++
oomdemo/.idea/jarRepositories.xml | 20 ++++++++++++
oomdemo/.idea/misc.xml | 14 +++++++++
oomdemo/oomdemo.iml | 2 ++
oomdemo/pom.xml | 12 ++++++++
oomdemo/src/main/java/com/woniu/OOMTest.java | 29 ++++++++++++++++++
.../target/classes/com/woniu/OOMTest.class | Bin 0 -> 724 bytes
8 files changed, 98 insertions(+)
create mode 100644 oomdemo/.idea/.gitignore
create mode 100644 oomdemo/.idea/compiler.xml
create mode 100644 oomdemo/.idea/jarRepositories.xml
create mode 100644 oomdemo/.idea/misc.xml
create mode 100644 oomdemo/oomdemo.iml
create mode 100644 oomdemo/pom.xml
create mode 100644 oomdemo/src/main/java/com/woniu/OOMTest.java
create mode 100644 oomdemo/target/classes/com/woniu/OOMTest.class
diff --git a/oomdemo/.idea/.gitignore b/oomdemo/.idea/.gitignore
new file mode 100644
index 0000000..50dea33
--- /dev/null
+++ b/oomdemo/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Datasource local storage ignored files
+/../../../../:\java project\oomdemo\.idea/dataSources/
+/dataSources.local.xml
+# Editor-based HTTP Client requests
+/httpRequests/
diff --git a/oomdemo/.idea/compiler.xml b/oomdemo/.idea/compiler.xml
new file mode 100644
index 0000000..25ba5e2
--- /dev/null
+++ b/oomdemo/.idea/compiler.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/oomdemo/.idea/jarRepositories.xml b/oomdemo/.idea/jarRepositories.xml
new file mode 100644
index 0000000..712ab9d
--- /dev/null
+++ b/oomdemo/.idea/jarRepositories.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/oomdemo/.idea/misc.xml b/oomdemo/.idea/misc.xml
new file mode 100644
index 0000000..4b661a5
--- /dev/null
+++ b/oomdemo/.idea/misc.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/oomdemo/oomdemo.iml b/oomdemo/oomdemo.iml
new file mode 100644
index 0000000..78b2cc5
--- /dev/null
+++ b/oomdemo/oomdemo.iml
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/oomdemo/pom.xml b/oomdemo/pom.xml
new file mode 100644
index 0000000..354ee99
--- /dev/null
+++ b/oomdemo/pom.xml
@@ -0,0 +1,12 @@
+
+
+ 4.0.0
+
+ com.woniu
+ oomdemo
+ 1.0-SNAPSHOT
+
+
+
\ No newline at end of file
diff --git a/oomdemo/src/main/java/com/woniu/OOMTest.java b/oomdemo/src/main/java/com/woniu/OOMTest.java
new file mode 100644
index 0000000..d88134d
--- /dev/null
+++ b/oomdemo/src/main/java/com/woniu/OOMTest.java
@@ -0,0 +1,29 @@
+package com.woniu;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 内存溢出的参数
+ * Eclipse Memory Analyzer分析内存溢出
+ * -Xms20m -Xmx20m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=D:\woniu
+ *
+ *1.占用内存过大的对象有哪些 (Histogram)
+ *2.被谁引用的 (dominator_tree)
+ *3.定位到具体的代码 (thread_overview)
+ *
+ * 排查的过程都很简单,难的是如何解决,如果代码是自己写的,那一会就改完了,
+ * 如果是一些中间件的代码造成的内存溢出就要求你对中间件的实现有个基本的了解才能解决!
+ */
+public class OOMTest {
+
+
+ public static void main(String[] args) {
+ List memoryLeakArray = new ArrayList();
+ for (int i = 0; i < 1024; i++) {
+ byte[] tmp = new byte[1024 * 1024]; // 添加1M的数据到List中
+ memoryLeakArray.add(tmp); //warning: 这里会造成OOM
+ }
+ }
+
+}
diff --git a/oomdemo/target/classes/com/woniu/OOMTest.class b/oomdemo/target/classes/com/woniu/OOMTest.class
new file mode 100644
index 0000000000000000000000000000000000000000..0bf6e7b8356b3128716eb339eb62b2e5daad0dd9
GIT binary patch
literal 724
zcmZuv%Wl&^6g^|Rahj$Nr>!ZWv_M-(i@+OpDU~P^5|Z02QWZf~6UR!YjqS*FK-u#p
zNQgD7iih|B{)AsZ;&H|7}91>8o*KbFs>H;{4PYiFs7`%PWS%%Y)y(b*LcivMFm
zWZKt!|3Oew6h=up_CtB{AWh|1V6Gq@WoqF0Dlh8(DRVshC3WGi-0jZp4nI!YjBn>tlKU_MLZ_F!1E1A>RD>qRA~j
z9iUEnV38_ZIJiW+gcaI#p6G&G%yW6_pazpF>zKy^OR*49F4r=y61PMdm+5JNMWoK%
Ul{{j6L&e6j_{t2yY~A