如何配置tomcat 6,以便如果它因内存不足而崩溃,我会收到堆转储?
我知道jmap
可用于在运行时获取它
我可以看到有关如何获取tomcat 7的信息 http://blog.denevell.org/tomcat7-heap-dump-out-of-memory.html
由于
答案 0 :(得分: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.)