java.lang.OutOfMemoryError: Java heap space
Dumping heap to java_pid16816.hprof ...
Heap dump file created [18570036 bytes in 0.027 secs]
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:3210)
at java.util.Arrays.copyOf(Arrays.java:3181)
at java.util.ArrayList.grow(ArrayList.java:267)
at java.util.ArrayList.ensureExplicitCapacity(ArrayList.java:241)
at java.util.ArrayList.ensureCapacityInternal(ArrayList.java:233)
at java.util.ArrayList.addAll(ArrayList.java:585)
at com.TestJvm.main(TestJvm.java:21)
Dumping heap to C:\Users\admin\AppData\Local\Temp\heapdump2021-04-26-14-408865243791871134538.hprof ...
Heap dump file created
thread 列出线程的信息
Threads Total: 37, NEW: 0, RUNNABLE: 10, BLOCKED: 0, WAITING: 4, TIMED_WAITING: 6, TERMINATED: 0, Internal threads: 17
ID NAME GROUP PRIORITY STATE %CPU DELTA_TIME TIME INTERRUPTED DAEMON
2 Reference Handler system 10 WAITING 0.0 0.000 0:0.000 false true
3 Finalizer system 8 WAITING 0.0 0.000 0:0.000 false true
4 Signal Dispatcher system 9 RUNNABLE 0.0 0.000 0:0.000 false true
5 Attach Listener system 5 RUNNABLE 0.0 0.000 0:0.171 false true
13 RMI TCP Accept-0 system 5 RUNNABLE 0.0 0.000 0:0.109 false true
15 RMI Scheduler(0) system 5 TIMED_WAITI 0.0 0.000 0:0.000 false true
22 arthas-timer system 5 WAITING 0.0 0.000 0:0.000 false true
25 arthas-NettyHttpTelnetBootstrap-3-1 system 5 RUNNABLE 0.0 0.000 0:0.000 false true
26 arthas-NettyWebsocketTtyBootstrap-4- system 5 RUNNABLE 0.0 0.000 0:0.000 false true
27 arthas-NettyWebsocketTtyBootstrap-4- system 5 RUNNABLE 0.0 0.000 0:0.000 false true
28 arthas-shell-server system 5 TIMED_WAITI 0.0 0.000 0:0.000 false true
29 arthas-session-manager system 5 TIMED_WAITI 0.0 0.000 0:0.000 false true
30 arthas-UserStat system 5 WAITING 0.0 0.000 0:0.000 false true
32 arthas-NettyHttpTelnetBootstrap-3-2 system 5 RUNNABLE 0.0 0.000 0:0.093 false true
33 arthas-command-execute system 5 RUNNABLE 0.0 0.000 0:0.078 false true
1 main main 5 TIMED_WAITI 0.0 0.000 0:0.093 false false
thread 查看指定线程PID详情
[arthas@48568]$ thread 1
"main" Id=1 TIMED_WAITING
at java.lang.Thread.sleep(Native Method)
at com.TestJvm.main(TestJvm.java:22)
thread -n <数量> 查看指定条数线程详情
[arthas@48568]$ thread -n 2
"Reference Handler" Id=2 cpuUsage=0.0% deltaTime=0ms time=0ms WAITING on java.lang.ref.Reference$Lock@2ba7f086
at java.lang.Object.wait(Native Method)
- waiting on java.lang.ref.Reference$Lock@2ba7f086
at java.lang.Object.wait(Object.java:502)
at java.lang.ref.Reference.tryHandlePending(Reference.java:191)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:153)
"Finalizer" Id=3 cpuUsage=0.0% deltaTime=0ms time=0ms WAITING on java.lang.ref.ReferenceQueue$Lock@37b860c4
at java.lang.Object.wait(Native Method)
- waiting on java.lang.ref.ReferenceQueue$Lock@37b860c4
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:144)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:165)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:216)