1

如何配置 tomcat 6,以便如果它因内存不足错误而崩溃,我会得到一个堆转储?

我知道jmap可以在它运行时用来获取它

我可以看到有关如何为 tomcat 7 获取它的信息 http://blog.denevell.org/tomcat7-heap-dump-out-of-memory.html

谢谢

4

1 回答 1

4

您应该在 的乞求(评论后)中添加以下行tomcat6/bin/catalina.sh

JAVA_OPTS="$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/path/to/dir"

文档: http ://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html

-XX:HeapDumpPath=./java_pid<pid>.hprof  Path to directory or filename for heap dump. Manageable. (Introduced in 1.4.2 update 12, 5.0 update 7.)
-XX:-HeapDumpOnOutOfMemoryError Dump heap to file when java.lang.OutOfMemoryError is thrown. Manageable. (Introduced in 1.4.2 update 12, 5.0 update 7.)
于 2013-09-02T19:07:07.090 回答