jvm内存泄漏排查流程

1.查询cpu消耗最大的进程

jps 先找出来那些java进程

top 命令查看那些java进程消耗的cpu比较大

2.查找占用内存最大的线程

1.命令:ps p pid -L -o pcpu,pid,tid,time,tname,cmd

%CPU   PID   TID     TIME TTY      CMD
 0.0 32060 32060 00:00:00 ?        /data/java
 0.0 32060 32061 00:00:00 ?        /data/java

打印线程的10进制格式为16进制格式(TID对应的那一列):

printf "%x\n"  32061
7d3d

3.查询jstack中对应的线程信息

[root@10-10-244-163 ~]# jstack 32060|grep 7d3d -C 10
        at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:216)

"Reference Handler" #2 daemon prio=10 os_prio=0 tid=0x00007f6dc0108000 nid=0x7d41 in Object.wait() [0x00007f6da99cb000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        at java.lang.Object.wait(Object.java:502)
        at java.lang.ref.Reference.tryHandlePending(Reference.java:191)
        - locked <0x00000000c08d0ab8> (a java.lang.ref.Reference$Lock)
        at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:153)

"main" #1 prio=5 os_prio=0 tid=0x00007f6dc000d000 nid=0x7d3d runnable [0x00007f6dc9e1a000]
   java.lang.Thread.State: RUNNABLE
        at java.net.PlainSocketImpl.socketAccept(Native Method)
        at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:409)
        at java.net.ServerSocket.implAccept(ServerSocket.java:545)
        at java.net.ServerSocket.accept(ServerSocket.java:513)
        at org.apache.catalina.core.StandardServer.await(StandardServer.java:453)
        at org.apache.catalina.startup.Catalina.await(Catalina.java:777)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:723)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

你可能感兴趣的:(1_java,基础)