Eclipse – Java.Lang.OutOfMemoryError: Java Heap Space(转)
In Eclipse IDE, if your program is consuming a lot of memory (loading big data) like this :
List<Domain> list = domainBo.findAllDomain(100000);
for(Domain domain : list){
process(domain.getDomainName());
}
It can easily hit java.lang.OutOfMemoryError: Java heap space :
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.HashMap.<init>(HashMap.java:209)
at java.util.LinkedHashMap.<init>(LinkedHashMap.java:181)
1. Solution – VM arguments
On Eclipse menu, clicks Run -> Run Configurations.., select the Java application you want to run, clicks on theArguments tab, update the VM arguments with the following options
-Xms<size> - Set initial Java heap size
-Xmx<size> - Set maximum Java heap size
For example, -Xms512M -Xmx1024M

2. Mistake – eclipse.ini
The memory settings in eclipse.ini is allocated to Eclipse IDE only, not the program you want to run. A very common mistake is updated the heap size in eclipse.ini, and expects it to solve above out of memory problem.
The Java application, Ant / Maven build scripts, or unit test cases, are run as an external tool from Eclipse, and it does not inherit the VM settings in eclipse.ini.
But, if your Eclipse IDE is always crashed by no reason, you can try to increase the heap size and perm gen ineclipse.ini.
-startu
openFile
-showsplash
//...
-XX:MaxPermSize=512m
-Xms512m
-Xmx1024m
//...
-Xdock:icon=../Resources/Eclipse.icns
-XstartOnFirstThread
P.S eclipse.ini is located in the Eclipse installation folder.
Eclipse – java.lang.OutOfMemoryError: Java heap space
http://www.mkyong.com/eclipse/eclipse-java-lang-outofmemoryerror-java-heap-space/
Eclipse – Java.Lang.OutOfMemoryError: Java Heap Space(转)的更多相关文章
- eclipse内存溢出报错:java.lang.OutOfMemoryError:Java heap space
今天执行了一个比較大的程序,处理的数据达到126MB数据,将数据导入数据库中,用eclipse 来訪问时候,总是出现java.lang.OutOfMemoryError:Java heap space ...
- eclipse:Tomcat设置jvm,解决java.lang.OutOfMemoryError: Java heap space 堆内存溢出
eclipse 有启动参数里设置jvm大小,因为eclipse运行时自己也需要jvm,所以eclipse.ini里设置的jvm大小不是具体某个程序运行时所用jvm的大小,这和具体程序运行的jvm大小无 ...
- eclipse中报错:java.lang.OutOfMemoryError: Java heap space
问题: 在eclipse中执行java程序.去重100多万的数据,报例如以下错误: java.lang.OutOfMemoryError: Java heap space 异常原因: 在JVM中假设9 ...
- Eclipse迅速执行:Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
问题叙述性说明: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space 问题原因: 程序中对 ...
- eclipse运行程序时报java.lang.OutOfMemoryError: Java heap space内存不足问题
System.setProperty("webdriver.firefox.bin", "D:\\Mozilla Firefox\\firefox.exe"); ...
- 解决eclipse maven install 造成JVM 内存溢出(java.lang.OutOfMemoryError: Java heap space)
maven install 报错信息: The system is out of resources.Consult the following stack trace for details.jav ...
- 【转】java.lang.OutOfMemoryError: Java heap space的解决
原文地址:http://blog.sina.com.cn/s/blog_4b12778b0100v0bb.html Myeclipse下java.lang.OutOfMemoryError: Java ...
- 关于java.lang.OutOfMemoryError: Java heap space的错误分析
今天无意间遇到这个错误:java.lang.OutOfMemoryError: Java heap space 问题出现原因:使用a标签实现快速下载[当然已经实现了,但想了想还是要归纳解决这类问题] ...
- Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space解决方法 问题描述 Exception ...
随机推荐
- 从零开始的Python学习Episode 20——面向对象(3)
面向对象之封装 封装,即隐藏对象的属性和实现细节,仅对外公开接口,控制在程序中属性的读和修改的访问级别:将抽象得到的数据和行为(或功能)相结合,形成一个有机的整体. 隐藏 在python中用双下划线开 ...
- 第五章 if语句
5.2条件测试 使用==判断相当: 使用!=判断不相等: 每条if语句的核心都是一个值为Tre或False的表达式,这种表达式被称为条件测试,如果条件测试的值为Ture,则执行紧跟在if语句后面的代码 ...
- Codeforces1151E,F | 553Div2 | 瞎讲报告
传送链接 E. Number of Components 当时思博了..一直在想对于\([1,r]\)的联通块和\([1,l-1]\)的联通块推到\([l,r]\)的联通块...我真的是傻了..这题明 ...
- SQL IF while 游标
-- if语句使用示例 declare @a int set @a=1 begin print @a =@a+1 end else begin print 'noooo' end -- while语句 ...
- 搭建gitpage博客
http://blog.csdn.net/jzooo/article/details/46781805
- C++ 类 复制构造函数 The Copy Constructor
一.复制构造函数的定义 复制构造函数是一种特殊的构造函数,具有一般构造函数的所有特性.复制构造函数创建一个新的对象,作为另一个对象的拷贝.复制构造函数只含有一个形参,而且其形参为本类对象的引用.复制构 ...
- Git的基本使用方法和安装&心得体会(使用git命令行)
这是补发的,使用命令行操作的. (1)选择本地repository的路径 找到后点鼠标右键,选择git bash here. (2) clone到本地 在命令行输入 git clone ADDRESS ...
- SpringMVC入门学习案例笔记
一.数据库环境用mysql,数据库建表语句如下: /* SQLyog v10.2 MySQL - 5.1.72-community : Database - mybatis ************* ...
- 浅学CSS
CSS 规则由两个主要的部分构成:选择器,以及一条或多条声明: 选择器通常是您需要改变样式的 HTML 元素. 每条声明由一个属性和一个值组成. 属性(property)是您希望设置的样式属性(sty ...
- Android之自定义View学习(一)
Android之自定义View学习(一) Canvas常用方法: 图片来源 /** * Created by SiberiaDante on 2017/6/3. */ public class Bas ...