centos6.0非root用户JRE报资源不可用错误

2 篇文章 0 订阅

用非root用户启动某监控程序,报了如下错误:

There is insufficient memory for the Java Runtime Environment to continue.

# Native memory allocation (malloc) failed to allocate 549232 bytes for Chunk::new
# An error report file with more information is saved as:
# /opt/smc/hs_err_pid6659.log
#
# There is insufficient memory for the Java Runtime Environment to continue.
# pthread_getattr_np
# An error report file with more information is saved as:
# /opt/smc/hs_err_pid7631.log
OpenJDK 64-Bit Server VM warning: Attempt to allocate stack guard pages failed.
#
# There is insufficient memory for the Java Runtime Environment to continue.
# pthread_getattr_np
# An error report file with more information is saved as:
# /opt/smc/eventmonitor/sbin/hs_err_pid8109.log
#
# There is insufficient memory for the Java Runtime Environment to continue.
# pthread_getattr_np
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 40 bytes for symbol
# An error report file with more information is saved as:

# /opt/smc/hs_err_pid10567.log


运行java -version也报错:

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.


修改配置

/etc/security/limits.d目录下90-nproc.config,centos6.0的max user processes只有1024,而centos5.0的是278528,具体为什么这么做,不得而知。

90-nproc.config:

# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.
*          soft    nproc     278528
root       soft    nproc     unlimited

注释掉*  soft  nproc 1024或者修改1024为老版本的278528。

如果还不行,查看:/proc/sys/vm/overcommit_memory文件:

缺省设置:0(只读)

该文件指定了内核针对内存分配的策略,其值可以是0、1、2。

0, 表示内核将检查是否有足够的可用内存供应用进程使用;如果有足够的可用内存,内存申请允许;否则,内存申请失败,并把错误返回给应用进程。

1, 表示内核允许分配所有的物理内存,而不管当前的内存状态如何。

2, 表示内核允许分配超过所有物理内存和交换空间总和的内存(参照overcommit_ratio)。


如果此文件的值不为0,则修改为0。


结束,success!










  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

sg_0504

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值