Linux下idea运行很简单的sleep程序都会内存溢出
运行的代码如下:
System.out.println("===1===");
try {
Thread.sleep(1000);
System.out.println("===2===");
} catch (InterruptedException e) {
e.printStackTrace();
}
错误信息:
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.201-b09 mixed mode):
"Service Thread" #10 daemon prio=9 os_prio=0 tid=0x00007fad98367000 nid=0x7a1d runnable [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C1 CompilerThread3" #9 daemon prio=9 os_prio=0 tid=0x00007fad98363800 nid=0x7a1c waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread2" #8 daemon prio=9 os_prio=0 tid=0x00007fad98361800 nid=0x7a1b waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread1" #7 daemon prio=9 os_prio=0 tid=0x00007fad9835f800 nid=0x7a1a waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread0" #6 daemon prio=9 os_prio=0 tid=0x00007fad9835d800 nid=0x7a19 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"Monitor Ctrl-Break" #5 daemon prio=5 os_prio=0 tid=0x00007fad9835c000 nid=0x7a18 runnable [0x00007fad842ce000]
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:171)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
- locked (a java.io.InputStreamReader)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at java.io.BufferedReader.fill(BufferedReader.java:161)
at java.io.BufferedReader.readLine(BufferedReader.java:324)
- locked (a java.io.InputStreamReader)
at java.io.BufferedReader.readLine(BufferedReader.java:389)
at com.intellij.rt.execution.application.AppMainV2$1.run(AppMainV2.java:64)
"Signal Dispatcher" #4 daemon prio=9 os_prio=0 tid=0x00007fad9820a000 nid=0x7a17 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"Finalizer" #3 daemon prio=8 os_prio=0 tid=0x00007fad981d7000 nid=0x7a0f in Object.wait() [0x00007fad84551000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:144)
- locked (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:165)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:216)
"Reference Handler" #2 daemon prio=10 os_prio=0 tid=0x00007fad981d4800 nid=0x7a0e in Object.wait() [0x00007fad84652000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Object.java:502)
at java.lang.ref.Reference.tryHandlePending(Reference.java:191)
- locked (a java.lang.ref.Reference$Lock)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:153)
"main" #1 prio=5 os_prio=0 tid=0x00007fad9800d800 nid=0x79f7 waiting on condition [0x00007fad9f009000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at Main2.main(Main2.java:55)
"VM Thread" os_prio=0 tid=0x00007fad981cb000 nid=0x7a0c runnable
"GC task thread#0 (ParallelGC)" os_prio=0 tid=0x00007fad98023800 nid=0x7a00 runnable
"GC task thread#1 (ParallelGC)" os_prio=0 tid=0x00007fad98025000 nid=0x7a01 runnable
"GC task thread#2 (ParallelGC)" os_prio=0 tid=0x00007fad98027000 nid=0x7a02 runnable
"GC task thread#3 (ParallelGC)" os_prio=0 tid=0x00007fad98028800 nid=0x7a03 runnable
"GC task thread#4 (ParallelGC)" os_prio=0 tid=0x00007fad9802a800 nid=0x7a04 runnable
"GC task thread#5 (ParallelGC)" os_prio=0 tid=0x00007fad9802c000 nid=0x7a07 runnable
"GC task thread#6 (ParallelGC)" os_prio=0 tid=0x00007fad9802e000 nid=0x7a08 runnable
"GC task thread#7 (ParallelGC)" os_prio=0 tid=0x00007fad9802f800 nid=0x7a09 runnable
"VM Periodic Task Thread" os_prio=0 tid=0x00007fad98369800 nid=0x7a1e waiting on condition
JNI global references: 12
Heap
PSYoungGen total 74752K, used 3870K [0x000000076d000000, 0x0000000772300000, 0x00000007c0000000)
eden space 64512K, 6% used [0x000000076d000000,0x000000076d3c7b10,0x0000000770f00000)
from space 10240K, 0% used [0x0000000771900000,0x0000000771900000,0x0000000772300000)
to space 10240K, 0% used [0x0000000770f00000,0x0000000770f00000,0x0000000771900000)
ParOldGen total 171008K, used 0K [0x00000006c7000000, 0x00000006d1700000, 0x000000076d000000)
object space 171008K, 0% used [0x00000006c7000000,0x00000006c7000000,0x00000006d1700000)
Metaspace used 3012K, capacity 4496K, committed 4864K, reserved 1056768K
class space used 330K, capacity 388K, committed 512K, reserved 1048576K