How do I produce a heap dump with only a JRE?

后端 未结 4 1879
抹茶落季
抹茶落季 2020-12-31 04:32

We have a JRE installed on our production environment, but not a JDK. The versions of the JRE and OS are below.

[me@mymachine ~]$ java -version
java version &         


        
4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-31 04:52

    Built-in tools like jmap, jconsole, and jvisualvm are only available in a JDK. Another option is to add the VM argument -XX:+HeapDumpOnOutOfMemoryError which tells the JVM to automatically generate a heap dump when an OutOfMemoryError occurs, and the argument -XX:HeapDumpPath to specify the path for the heap dump.

    If you cannot upgrade your JRE to use tools like the ones in the server JRE 7 (http://www.oracle.com/technetwork/java/javase/downloads/server-jre7-downloads-1931105.html), you may have to consider third-party profiling tools like JProfiler or ones list here.

提交回复
热议问题