There is insufficient memory for the Java Runtime Environment to continue.apache
報錯信息以下 :tomcat
#socket
# There is insufficient memory for the Java Runtime Environment to continue.spa
# Native memory allocation (malloc) failed to allocate 1293536 bytes for Chunk::neworm
# An error report file with more information is saved as:進程
# D:\Tools\Tomcat\apache-tomcat-8.0.26\bin\hs_err_pid9192.log內存
[error occurred during error reporting , id 0xc0000005]ci
Disconnected from the target VM, address: '127.0.0.1:49585', transport: 'socket'get
Tomcat默承認以使用的內存爲128MB,對於訪問數比較多、比較吃內存的應用來講,這是不夠的。咱們能夠經過調整Java虛擬機的啓動參數來增長Tomcat可以使用的內存。
下面就是衆所周知的兩個參數
-Xms<size> JVM初始化堆的大小
-Xmx<size> JVM堆的最大值
好比,我想設置初始內存大小爲128M,最多佔用1G,就是下面的設置:
-Xms128m
-Xmx1024m
在Linux/Unix下,能夠經過在 {tomcat_dir}/bin/catalina.sh 中增長或修改 JAVA_OPTS 來達到:
JAVA_OPTS="-Xms128m -Xmx1024m"
在Windows的免安裝版本,能夠經過在 {tomcat_dir}/bin/catalina.bat 中增長或修改 JAVA_OPTS 來達到:
set JAVA_OPTS=-Xms128m -Xmx1024m
虛擬機
設置以後,查看進程管理揮發現,內存大小很接近Xmx這個值