gpt4 book ai didi

java - -XX :OnOutOfMemoryError ="kill -9 %p" Problem

转载 作者:行者123 更新时间:2023-12-02 03:25:31 24 4
gpt4 key购买 nike

我在尝试将 -XX:OnOutOfMemoryError="kill -9 %p" 命令传递到我的 jvm 参数时遇到问题。

我正在使用 Jetty7,并将其包含在 start.ini 文件中。启动时它给我以下错误。这是与jre/jre1.6.0_03l64

Starting Jetty: STARTED Jetty Tue Apr 26 09:54:26 EDT 2011
Unrecognized option: -9
Could not create the Java virtual machine.

start.ini文件如下。

#===========================================================
# If the arguements in this file include JVM arguments
# (eg -Xmx512m) or JVM System properties (eg com.sun.???),
# then these will not take affect unless the --exec
# parameter is included or if the output from --dry-run
# is executed like:
# eval $(java -jar start.jar --dry-run)
#
# Below are some recommended options for Sun's JRE
#-----------------------------------------------------------
--exec
# -Dcom.sun.management.jmxremote
-Xmx4096m
-Xmn512m
-DLABEL=PROD_APP
-verbose:gc
-Xloggc:/export/opt/prod_app/logs/gc.log
-XX:OnOutOfMemoryError="kill -9 %p"
# -XX:+PrintGCDateStamps
-XX:+PrintGCTimeStamps
-XX:+PrintGCDetails
-XX:+PrintTenuringDistribution
# -XX:+PrintCommandLineFlags
# -XX:+DisableExplicitGC
# -XX:+UseConcMarkSweepGC
# -XX:ParallelCMSThreads=2
# -XX:+CMSClassUnloadingEnabled
# -XX:+UseCMSCompactAtFullCollection
# -XX:CMSInitiatingOccupancyFraction=80

注释 jetty 线路将开始正常,没有任何问题。然而,由于系统内存泄漏,我们确实需要添加这个参数,以防止我们的进程崩溃时造成进一步的损坏。

有人知道我在这里做错了什么或者我该如何解决这个问题吗?

最佳答案

在 Java 版本 8u92 中,VM 参数

  • -XX:+ExitOnOutOfMemoryError
  • -XX:+CrashOnOutOfMemoryError

已添加,请参阅 release notes .

ExitOnOutOfMemoryError
When you enable this option, the JVM exits on the first occurrence of an out-of-memory error. It can be used if you prefer restarting an instance of the JVM rather than handling out of memory errors.

CrashOnOutOfMemoryError
If this option is enabled, when an out-of-memory error occurs, the JVM crashes and produces text and binary crash files.

增强请求:JDK-8138745 (参数命名错误 JDK-8154713ExitOnOutOfMemoryError 而不是 ExitOnOutOfMemory)

关于java - -XX :OnOutOfMemoryError ="kill -9 %p" Problem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56908648/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com