Trigger Heap Dump of a 1.5 JVM running on Windows

后端 未结 2 479
猫巷女王i
猫巷女王i 2021-01-13 10:09

I\'m trying to diagnose a PermGen memory leak problem in a Sun One 9.1 Application Server. In order to do that I need to get a heap dump of the JVM process. Unfortunately, t

相关标签:
2条回答
  • If it's 1.5.0_14 or later, you can use -XX:+HeapDumpOnCtrlBreak and hit Ctrl-Break in the console

    0 讨论(0)
  • 2021-01-13 10:27

    There was a new hotspot option introduced in Java6, -XX:-HeapDumpOnOutOfMemoryError, which was actually backported to the Java5 JVM.

    http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp

    Dump heap to file when java.lang.OutOfMemoryError is thrown. Manageable. (Introduced in 1.4.2 update 12, 5.0 update 7.)

    It's very handy. The JVM lives just long enough to dump its heap to a file, then falls over.

    Of course, it does mean that you have to wait for the leak to get bad enough to trigger an OutOfMemoryError.

    An alternative is to use a profiler, like YourKit. This provides the means to take a heap snapshot of a running JVM. I believe it still supports Java5.

    P.S. You really need to upgrade to java 6....

    0 讨论(0)
提交回复
热议问题