Centos6.4  Jdk1.6

1.在终端输入Java命令报错

[root@localhost local]# 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.

2.是系统参数(overcommit_memory和overcommit_ratio)配置的问题

3.查看系统内存分配状态

[root@localhost local]# grep -i commit /proc/meminfo
CommitLimit: kB
Committed_AS: kB

  看到CommitLimit和Committed_As参数。

  CommitLimit是一个内存分配上限,CommitLimit = 物理内存 * overcommit_ratio(默认50,即50%) + swap大小
  Committed_As是已经分配的内存大小。

4.内核参数overcommit_memory

[root@localhost local]# cat /etc/sysctl.conf | grep overcommit_memory
vm.overcommit_memory=

  它是 内存分配策略

  可选值:0、1、2。
  0, 表示内核将检查是否有足够的可用内存供应用进程使用;如果有足够的可用内存,内存申请允许;否则,内存申请失败,并把错误返回给应用进程。
  1, 表示内核允许分配所有的物理内存,而不管当前的内存状态如何。
  2, 表示内核允许分配超过所有物理内存和交换空间总和的内存

5. 解决办法
  将vm.overcommit_memory 设为1即可
  有三种方式修改内核参数,但要有root权限:

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

2)sysctl vm.overcommit_memory=1

3)echo 1 > /proc/sys/vm/overcommit_memory

参考:http://blog.csdn.net/whycold/article/details/21388455

http://blog.csdn.net/jollyjumper/article/details/24127009

Could not reserve enough space for object heap解决办法的更多相关文章

  1. eclipse scala Could not reserve enough space for object heap

    [学习笔记] 防盗版实名手机尾号:73203 Could not reserve enough space for object heap 解决方法:下面的缩写中:一个是memory max(Xmx) ...

  2. Android Studio: Failed to sync Gradle project 'xxx' Error:Unable to start the daemon process: could not reserve enough space for object heap.

    创建项目的时候报错: Failed to sync Gradle project 'xxx' Error:Unable to start the daemon process: could not r ...

  3. Tomcat启动报错 Could not reserve enough space for object heap

    报错信息: Error occurred during initialization of VM Could not reserve enough space for object heap Coul ...

  4. 启动tomcat报错 Could not reserve enough space for object heap的解决办法

    问题:打开eclips启动tomcat发现报出Could not reserve enough space for object heap错误. 解决办法:1.首先检查tomcat是否能正常启动.re ...

  5. Error occurred during initialization of VM Could not reserve enough space for object heap

    Error occurred during initialization of VM Could not reserve enough space for object heap Java虚拟机(JV ...

  6. fisheye Error occurred during initialization of VM Could not reserve enough space for object heap 问题解决!

    参考文章:https://answers.atlassian.com/questions/9397/not-enough-heap-space-to-run-fisheye fisheye下载好了之后 ...

  7. 构建工具----gradle---可能遇到的问题----Could not reserve enough space for object heap

    Could not reserve enough space for object heap 意思是 jvm的设置内存不足以运行gradle命令了. 分为两种情况,解决的方法也不同. .10/user ...

  8. JVM启动报错: Could not reserve enough space for object heap error

    首先了解一下参数的含义: 参数 含义 -Xms2G -Xmx2G 代表jvm可用的heap内存最小和最大 -XX:PermSize -XX:MaxPermSize 代表jvm的metadata内存的大 ...

  9. Android Studio Gradle Could not reserve enough space for object heap

    Studio 创建第一个工程报错 Error:Unable to start the daemon process.This problem might be caused by incorrect ...

随机推荐

  1. 读取文件之<绝对路径>与<相对路径>

    前言:字符流.字节流读取文件,下面的代码是在网上找到的一个各种文件读取方式,还算比较详细,分享给大家. public class ReadFromFile { /** * 以字节为单位读取文件,常用于 ...

  2. 简单的c语言小程序 回光返照

    主函数 int main(int argc,char * argv[]) -- arg代表英文的参数缩写 c代表count计数 argc { return 0;  -- 0返还给系统,代表程序正确运行 ...

  3. hdu1754(splay tree 单点更新,成段查询)

    题意就是简单的点更新,成段查询. splay tree 果真是常数比较大的log(n)操作. 比线段树还慢了这么多. // // main.cpp // splay // // Created by ...

  4. java数据结构之枚举

    Enumeration接口中定义了一些方法,通过这些方法可以枚举(一次获得一个)对象集合中的元素. import java.util.Vector; import java.util.Enumerat ...

  5. Young Maids

    E - Young Maids Time limit : 2sec / Memory limit : 256MB Score : 800 points Problem Statement Let N  ...

  6. node.js 关于跨域和传递给前台参数

    /*为app添加中间件处理跨域请求*/ app.use(function(req, res, next) { res.header("Access-Control-Allow-Origin& ...

  7. GridView实现编辑删除

    前台界面: <asp:GridView ID=" ForeColor="#333333" AutoGenerateColumns=" OnRowCance ...

  8. ubuntu1.4搭建zookeeper3.5.2分布式集群

    1.下载 官网链接:http://mirrors.hust.edu.cn/apache/zookeeper/zookeeper-3.5.2-alpha/zookeeper-3.5.2-alpha.ta ...

  9. es字符串字段类型的私有属性 建立索引的分析器 用于查询的分析器 短语查询优化

    除了公共属性外,基于字符串的字段还有私有属性 term_vector  是否计算该字段的Lucene词向量term vector no  默认值 yes with_offsets with_posit ...

  10. <2013 12 28> AOI PCB设计

    主要设计指标: “3.多块拼板最大尺寸:60*50(CM)4. 检测速度:(230-250)片/小时 5.检测通过率:98%6.最窄线宽:设两种精度 A.最窄线宽:0.2mm, 识别精度 0.1mm  ...