尝试将-XX:OnOutOfMemoryError="kill -9 %p"命令传递给我的jvm args时遇到问题.
我正在使用Jetty7,并在start.ini文件中使用它.在启动时,它给出了以下错误.这是jre /jre1.6.0_03l64
启动Jetty:STARTED Jetty Tue Apr 26 09:54:26 EDT 2011
无法识别的选项:-9
无法创建Java虚拟机.
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
Run Code Online (Sandbox Code Playgroud)
评论码头的线路将开始没有问题.但是,由于系统内存泄漏,我们确实需要添加此arg,以防止在我们的流程崩溃时进一步损坏.
谁会知道我在这里做错了什么或我如何解决这个问题?
fla*_*nze 18
在Java版本8u92中的VM参数
-XX:+ExitOnOutOfMemoryError -XX:+CrashOnOutOfMemoryError 添加了,请参阅发行说明.
ExitOnOutOfMemoryError
启用此选项时,JVM会在第一次出现内存不足错误时退出.如果您更喜欢重新启动JVM实例而不是处理内存不足错误,则可以使用它.CrashOnOutOfMemoryError
如果启用此选项,则在发生内存不足错误时,JVM会崩溃并生成文本和二进制崩溃文件.
增强请求:JDK-8138745(参数命名错误,但 JDK-8154713,ExitOnOutOfMemoryError而不是ExitOnOutOfMemory)