Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000097f00000, 305659904, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 305659904 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /opt/hs_err_pid121350.log
解决方案:
1.首先用命令free查看系统内Swap 分区大小
total used free shared buffers cache
Mem: 1002 964 38 0 21 410
-/+ buffers/cache: 532 470
Swap: 1024 24 1000
2.添加swap文件
mkdir swap
cd swap
sudo dd if=/dev/zero of=sfile bs=1024 count=1000000
count=1000000参数代表数量,这个正好是1g,直接增大1g
3.转化为swap文件
sudo mkswap sfile
4.激活swap文件
sudo swapon sfile
5.查看效果
再次输入:free -m