在启动java程序时,报如下错误

Error occurred during initialization of VM

Could not reserve enough space for object heap

Error: Could not create the Java Virtual Machine.

Error: A fatal exception has occurred. Program will exit.


 grep -i commit /proc/meminfo

CommitLimit:    15550904 kB

Committed_AS:   15098404 kB

如果显示的内存比物理内存小,很有可能是限制了内存,

1)sysctl vm.overcommit_memory=1

2)编辑/etc/sysctl.conf ,改vm.overcommit_memory=1,然后sysctl -p 使配置文件生效