Tool for debugging hangs in java application

前端 未结 3 1948
北荒
北荒 2020-12-30 03:44

I\'ve got a java application that half the time just hangs, and the other half the JVM crashes. Is there a tool I can use to see what\'s going on that makes it hang and/or c

3条回答
  •  时光说笑
    2020-12-30 04:06

    For starters I would suggest JVisualVM. It comes with the JDK, so you should just need to type jvisualvm into the command line to start it.

    Once it starts, you can connect to a running JVM, so you should be able to connect to your hung Java process and inspect the stack dump for all its running threads as well as the contents of the heap.


    Other useful built-in tools include:

    jps lists process ids of running java processes

    jstack prints a stack dump for each thread in the specified JVM process

    jmap generates a heap dump for the specified JVM process (jvisualvm can also generate heap dumps)

    jhat analyzes heap dumps generated with jmap or jvisualvm


    Of couse, there are also more sophisticated profilers available. JProfiler is quite highly regarded.

提交回复
热议问题