Centos 解决系统内存不足报错

执行命令时报如下错误。

[root@localhost apache-pulsar-2.10.1]# bin/pulsar initialize-cluster-metadata --cluster zetag-pulsar
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000080000000, 2147483648, 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 2147483648 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /usr/local/pulsar/apache-pulsar-2.10.1/hs_err_pid5454.log

表示内存不足,无法执行程序

执行如下命令:查看内存使用情况

free -h

可以看到可用内存空间太小,

解决办法

将一些无用的服务关掉,解除占用。 执行命令

ps -aux

我已经将docker卸载了,可这里还有相关进程,说明没处理干净。 执行如下命令:杀掉相关进程

kill -9 PID

例如执行 kill -9 1961 #杀掉docker-current

然后再次查看

经验分享 程序员 微信小程序 职场和发展