tomcat报错,tomcat被强行停止
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000cefb0000, 243351552, 0) failed; error='cannot allocate memory' (errno=12)
应该是java虚拟机内存溢出,修改JVM内存参数即可!没试验,等在出现这个问题的时候再说!待续
If that was the problem, I'd guess the system has not much memory available to the rest of the system. You might want to leave around 25% of the memory unused so linux can cache stuff and avoid swapping. I usually give Railo less then 1/3 of the total memory so database and other services have a 1/3 and system has a third. I'd give database a greater share in a larger system.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
To be honest, I think using a bunch of JVM flags from blogs/google searches is a bad idea, and is potentially why you have run into this problem.
When I went through this exercise late last year, I researched each flag I saw mentioned around the place. Most of them were already set as default in modern JVMs and others were simply misunderstood.
For our high traffic (and now very fast) site, this is all I have for my JVMs:
export CATALINA_OPTS="-Xms768m \
-Xmx768m \
-XX:NewSize=448m \
-XX:MaxNewSize=448m \
-XX:MaxTenuringThreshold=32 \
-XX:MaxPermSize=128m \
-XX:+UseConcMarkSweepGC \
-XX:+CMSClassUnloadingEnabled \
-XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses \
The New size relates to the nature of the site, in that it has much more temporary allocations than permanent. But I did that based on analysis with visualvm and then testing.
Obviously you would choose your memory sizes based on your site profile.
But every single one is there for a demonstrable reason.
Phil
--------------------------
I think using a bunch of JVM flags from blogs/google searches is a bad idea, and is potentially why you have run into this problem.
I agree
but having said that I think that you also set some flags that you shouldn't mess with (like MaxNewSize and MaxTenuringThreshold) unless you have a very good reason to do so.
I recommend setting the following flags:
-Xms={minimum-heap-memory-in-mb}m
-Xmx={maximum-heap-memory-in-mb}m
-XX:MaxPermSize={maximum-perm-gen-in-mb}m
-XX:+HeapDumpOnOutOfMemoryError
the memory values should be set according to physical RAM size. MaxPermSize should be 256m if possible (though 128m can be used as minimum), and -Xmx should be between 1024m and 4096m, again, depends on available RAM.
------------------------------------
That's fine, but be aware and warned that JVM/GC settings are always heavily depending on one's hardware, OS, configuration, application as well as _optimisation goals_.
--------------------------------
Chris
**********************************2013/12/6更新*************************************************************
报错如下:
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000cf6de000, 248393728, 0) failed; error='无法分配内存' (errno=12) # # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (malloc) failed to allocate 248393728 bytes for committing reserved memory. # An error report file with more information is saved as: # /usr/local/Tomcat_Trans/bin/hs_err_pid4758.log
查看文件/usr/local/Tomcat_Trans/bin/hs_err_pid4758.log
https://groups.google.com/forum/#!topic/railo/cBWmSBMxQfU