On my VPS (CentOS) 4GB ram (2 + 2 dynamically assigned when needed) and i have tomcat running with following options JAVA_OPTS="-Xms256m -Xmx2048m -XX:MaxPermSize=256m".
Now when i try to start other java based app (like hudson server) i get following error:
There is insufficient memory for the Java Runtime Environment to continue. Native memory allocation (malloc) failed to allocate 664080 bytes for Chunk::new An error report file with more information is saved as: /server/hs_err_pid26476.log
It seems as if system could not allocate 650KB of memory, but it should have like 1.2 GB free.
free -m total used free shared buffers cached Mem: 4096 2816 1279 0 0 0 -/+ buffers/cache: 2816 1279 Swap: 0 0 0
I found somewhere that i should also check /proc/user_beancounters, which shows failcnt on privvmpages. I have no clue what that means (does the provider give 4GB of memory as he is supposed to? or is he cheating?)
# cat /proc/user_beancounters Version: 2.5 uid resource held maxheld barrier limit failcnt 70692271: kmemsize 15371949 15388993 41943040 46137344 0 lockedpages 0 0 1024 1024 0 privvmpages 720030 720189 1048576 1048576 9604 shmpages 9001 9001 65536 65536 0 dummy 0 0 9223372036854775807 9223372036854775807 0 numproc 109 109 256 256 0 physpages 173670 173780 9223372036854775807 9223372036854775807 0 vmguarpages 0 0 262144 262144 0 oomguarpages 174598 174708 9223372036854775807 262144 0 numtcpsock 30 30 1440 1440 0 numflock 14 14 752 826 0 numpty 1 1 64 64 0 numsiginfo 0 0 1024 1024 0 tcpsndbuf 601840 601840 6881280 10813440 0 tcprcvbuf 491520 491520 6881280 10813440 0 othersockbuf 174600 174600 4504320 8388608 0 dgramrcvbuf 0 0 1048576 1153432 0 numothersock 117 118 1440 1440 0 dcachesize 0 0 7340032 8074035 0 numfile 3516 3516 16384 16384 0 dummy 0 0 0 0 0 dummy 0 0 0 0 0 dummy 0 0 0 0 0 numiptent 18 18 400 405 0