1.内存溢出解决方案
修改catalina.sh文件。
要添加在
tomcat
的bin 下catalina.sh 里,位置cygwin=false前 。注意引号要带上,红色的为新添加的.
# OS specific support. $var _must_ be set to either true or false.
JAVA_OPTS="-Xms256m -Xmx512m -Xss1024K -XX:PermSize=128m -XX:MaxPermSize=256m"
cygwin=false
可能出现溢出的异常:
1.
![](https://i-blog.csdnimg.cn/blog_migrate/4e64d1ae9ddf75559b0b3ebbaf7b1b33.png)
2.tomcat无法关闭,启动
使用./shutdown.sh关闭tomcat时,如果代码中多出了
Error occured during initialization of VM.
Could not reserve enough space for object heap.
这两行代码,那么tomcat就没有关闭,程序正常跑着呢。然后在这样的情况下启动tomcat会出现如下的提示
could not create the java virtual machine
Error occurred during initialization of VM
Could not reserve enough space for object heap
其实问题还是跟上一个问题差不多。内存不足导致的。
可以先在服务器的根目录下使用
./mem.sh&
清下内存(不会影响正常程序)
然后kill不能关闭的tomcat。再启动就行了。
当然最好还是多分一些内存