触发Windows上运行的1.5 JVM的堆转储 [英] Trigger Heap Dump of a 1.5 JVM running on Windows

查看:73
本文介绍了触发Windows上运行的1.5 JVM的堆转储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试诊断Sun One 9.1应用程序服务器中的PermGen内存泄漏问题.为此,我需要获取JVM进程的堆转储.不幸的是,JVM进程是Windows上运行的1.5版.显然,没有一种触发堆转储的方法支持该设置.我可以让JVM在内存耗尽或关闭时进行堆转储,但是我需要能够在任意时间进行堆转储.

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, the JVM process is version 1.5 running on Windows. Apparently, none of the ways for triggering a heap dump support that setup. I can have the JVM do a heap dump after it runs out of memory, or when it shuts down, but I need to be able to get heap dumps at arbitrary times.

获取堆转储的两种常用方法是使用jmap或使用HotSpotDiagnostic MBean.这些都不支持Windows上的jvm 1.5.

The two often mentioned ways for getting heap dumps are either using jmap or using the HotSpotDiagnostic MBean. Neither of those support jvm 1.5 on Windows.

有没有我错过的方法?如果有一种方法可以以编程方式触发堆转储(不使用HotSpotDiagnostic MBean),那也可以...

Is there a method that I've missed? If there's a way to programmatically trigger a heap dump (without using the HotSpotDiagnostic MBean), that would do too...

如果真的不可能在Windows中执行此操作,我想我不得不求助于构建Linux VM并在那里进行调试.

If it's really not possible to do it in Windows, I guess I'd have to resort to building a Linux VM and doing my debugging in there.

谢谢.

推荐答案

Java6中引入了一个新的热点选项-XX:-HeapDumpOnOutOfMemoryError,该选项实际上已反向移植到Java5 JVM.

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

将堆转储到文件时 抛出java.lang.OutOfMemoryError. 可管理的. (在1.4.2中介绍 更新12,5.0更新7.)

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

非常方便. JVM的寿命刚好足以将其堆转储到文件中,然后崩溃.

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

当然,这确实意味着您必须等待泄漏变得严重到足以触发OutOfMemoryError.

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

一种替代方法是使用探查器,例如 YourKit .这提供了对正在运行的JVM进行堆快照的方法.我相信它仍然支持Java5.

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.您真的需要升级到Java 6....

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

这篇关于触发Windows上运行的1.5 JVM的堆转储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆