Skip to content

Commit 77b2d7b

Browse files
committed
PermSize
1 parent d156efc commit 77b2d7b

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

MD/OOM-analysis.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,6 @@ Process finished with exit code 1
4141

4242
## 方法区/运行时常量池溢出
4343

44+
> `JDK8` 中将永久代移除,使用 MetaSpace 来保存类加载之后的类信息。
45+
46+
`PermSize``MaxPermSize` 已经不能使用了,在 JDK8 中配置这两个参数将会发出警告。
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.crossoverjie.oom.heap;
2+
3+
import com.crossoverjie.proxy.jdk.CustomizeHandle;
4+
import com.crossoverjie.proxy.jdk.ISubject;
5+
import com.crossoverjie.proxy.jdk.impl.ISubjectImpl;
6+
7+
import java.lang.reflect.Proxy;
8+
9+
/**
10+
* Function:方法区内存溢出
11+
*
12+
* @author crossoverJie
13+
* Date: 29/12/2017 21:34
14+
* @since JDK 1.8
15+
*/
16+
public class PermGenOOM {
17+
18+
public static void main(String[] args) {
19+
while (true){
20+
CustomizeHandle handle = new CustomizeHandle(ISubjectImpl.class) ;
21+
ISubject subject = (ISubject) Proxy.newProxyInstance(PermGenOOM.class.getClassLoader(), new Class[]{ISubject.class}, handle);
22+
subject.execute() ;
23+
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)