StackoverFlowError
OutofMemoryError:java
-
heap space
- java堆内存溢出 -
GC overhead limit exceeded
GC时间过长导致,过长:超过98%的时间用来做GC并且回收了不到2%的堆内存
CPU使用率极高,但是GC却没有效果,报OutofMemoryError
设置JVM启动参数: -Xms10m -Xmx10m -XX:+PrintGCDetails -XX:MaxDirectMemorySize=5m
public class GCOverheadDemo {
public static void main(String[] args) {
int i = 0;
List<String> list = new ArrayList<>();
try {
while (true) {
list.add(String.valueOf(i).intern());
}
} catch (Throwable e) {
System.out.println("******" + i);
e.printStackTrace();
throw e;
}
}
}
-
Direct buffer memory
本地内存被用光时候, nio中使用常见 -
unbale create a new native thread
一个进程里面创建了多个线程(linux默认一个进程可以创建的线程数是1024个)
5.Metespace
元空间对象太多导致