I am using eclipse in windows 7. When I set the -Xmx argument larger than 1500m, the following error occurs:
Error occurred during initialization of VM
Could not reserve enough space for object heap
Both eclipse and jdk are 64 bit version. The physical memory of my machine is 4g. Here is eclipse.ini file:
-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502
-product
org.eclipse.epp.package.java.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms400m
-Xmx3840m
I thought under 64 bit java I could use more than 1.5g memory, but eclipse keeps throw the above error. Any ideas?
cheng
If your machine has 4G of RAM it does not mean that all of it is available to for the usage. The available RAM will always be less than 4 GB as the native OS and other applications running your machine will use some of the RAM. Quick way to find out the available RAM is
Open Notepad (you mentioned you are on windows 7.)
Click on Help -> About
It shows the physical memory available at the bottom.
There are no straight forward rules for choosing the heap size. It always involves tuning. An optimum value is arrived after some iterations. Check this post on the same forum.
Related
When I try to import in my main a serialized file the program stop working and throws: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space.
I know that this exception can be thrown because of a lack of memory but I don't think this is the reason in this case.
In my pc I have 8gb of RAM. This is the file .ini of Eclipse:
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20150204-1316
-product
org.eclipse.epp.package.java.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
1024M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
1024m
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xms512m
-Xmx7500m
-XX:+UseConcMarkSweepGC
-XX:-UseGCOverheadLimit
I noticed that although eclipse could use almost all the memory of my pc, when this error occurs, the RAM used is just 5Gb approximately.
The file I'm trying to import is of 500Mb. The same program worked for many files of 350Mb.
This is the line of code where the program crush, and is the first line of my program:
Classifier cls1 = (Classifier) weka.core.SerializationHelper.read("C:\\Users\\.....\\FileToImport.model");
For who knows, i'm using the Weka library.
Thank you for the answers!
The 'eclipse.ini' file sets the memory for Eclipse itself not your program.
To set the memory for your program open the 'Run > Run Configurations' dialog. Find your program in the Java Application section and specify the -Xmx option you want in the 'Arguments > VM arguments' section.
I am testing a simple recommender system built using Mahout in Eclipse.
If the preferences file is too big I am getting this error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.lang.String.substring(String.java:1939)
at java.lang.String.subSequence(String.java:1972)
at com.google.common.base.Splitter$SplittingIterator.computeNext(Splitter.java:612)
at com.google.common.base.Splitter$SplittingIterator.computeNext(Splitter.java:522)
at com.google.common.base.AbstractIterator.tryToComputeNext(AbstractIterator.java:64)
at com.google.common.base.AbstractIterator.hasNext(AbstractIterator.java:59)
at com.google.common.base.AbstractIterator.next(AbstractIterator.java:74)
at org.apache.mahout.cf.taste.impl.model.file.FileDataModel.processLine(FileDataModel.java:408)
at org.apache.mahout.cf.taste.impl.model.file.FileDataModel.processFile(FileDataModel.java:363)
at org.apache.mahout.cf.taste.impl.model.file.FileDataModel.buildModel(FileDataModel.java:259)
at org.apache.mahout.cf.taste.impl.model.file.FileDataModel.reload(FileDataModel.java:231)
at org.apache.mahout.cf.taste.impl.model.file.FileDataModel.<init>(FileDataModel.java:221)
at org.apache.mahout.cf.taste.impl.model.file.FileDataModel.<init>(FileDataModel.java:169)
at org.apache.mahout.cf.taste.impl.model.file.FileDataModel.<init>(FileDataModel.java:149)
at com.predictionmarketing.itemrecommend.ItemRecommend.main(ItemRecommend.java:35)
The file contains about 5 millions preference points.
I have already read several messages about this issue and my eclipse.ini is the following
-startup
../../../plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
--launcher.library
../../../plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.200.v20140603-1326
-product
org.eclipse.epp.package.java.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
3000m
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.6
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts
-XX:MaxPermSize=3000m
-Xms3000m
-Xmx6000m
-Xdock:icon=../Resources/Eclipse.icns
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts
Basically I added -Xmx6000m and changed -Xmx and MaxPermSize (both) to 3000m.
I am not very fluent in Java so I don't know if the settings are correct, but during the execution I can see something like
Heap size: 55M of total 3017M max 5996 mark 55M
Which seems to reflect the settings.
The weird thing is that I don't see much increase of the heap size during execution, also the free memory in my computer (mac os) is around 800M.
Where is the problem?
If the preferences file is smaller, everything works fine.
The eclipse.ini settings are only used for the Eclipse application.
When you Run a Java application from Eclipse you need to go to 'Run > Run Configurations'. Find your application in the Java application list. On the 'Arguments' tab enter your memory settings in the 'VM arguments' section.
Read Java Heap Space - How does -Xmx work exactly?
and
http://javarevisited.blogspot.gr/2011/05/java-heap-space-memory-size-jvm.html
Java Heap is not the same for every system i think that in Windows for example the default java Heap is 60 Mb
my friend and I are using java eclipse, my labtop is 64-bit and eclipse is working fine, but on my friend's labtop - which is 32-bit - eclipse is slow when startup, slow while debugging and sometimes it stops working and responding suddenly.
Our use of eclipse most of times is to do our homeworks and courses projects.
please I appreciate any help to make eclipse performance faster.
this is the eclipse.ini configuration
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20140116-2212
-product
org.eclipse.epp.package.standard.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xms40m
-Xmx512m
Hi #AMH9 there are couple of more reasons than just having 64-bit or 32-bit operating system. For e.g.
Are there any other programs running (consuming memory, CPU when the eclipse is being used.
How much memory has been allocated (Xmx, Xms, MaxPermSize) to eclipse using eclipse.ini?
What programs are being executed from eclipse? does that require higher memory?
32-bit machines cannot address equal amount of memory than 64-bit can. Hence, if you can figure out the answers for above questions, it will help you determine the exact configuration to be defined in the eclipse.ini file.
You can get more details about setting memory parameters here.
Hope that helps.
When running my Gwt app in eclipse environment & especially when refreshing the page I often have either "Out Of Memory Perm Size" problem or the page took very long time to load & finally die out.
Some instructions from other questions are not very clear & each person produces a different solution to set memory, which made me really confused.
Here is my eclipse.ini file in C:\eclipse-jee-juno-SR1-win32-x86_64\eclipse:
-clean
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20120522-1813
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Dhelp.lucene.tokenizer=standard
-Xms40m
-Xmx512m
Also, in my eclipse, Run--> Debug Configurations --> Arguments tab --> I saw
VM arguments: -Xmx2048m // this is quite high number why it still very slow??
I need the simplest way to fix it. so What is the simplest way to fix this problem?
Start up Visual VM and see what each generation of memory is doing.
I would focus on the perm gen. You can increase its setting like this:
-Xms256m -Xmx512m -XX:MaxPermSize=256m
You'd better be running on a 64-bit operating system. The 32 bit JVM won't allow max heap larger than 1.2-1.5MB.
Im having out of memory errors and generally a very slow eclipse running with window builder and dealing with some big visual classes, so after some research I realized that increasing the heap java size would solve the problem... and it did...
(on eclipse.ini)
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120522-1813
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
1024M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
1024m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Dhelp.lucene.tokenizer=standard
-Xms120m
-Xmx512m
-XX:MaxPermSize=1024m
now I dont see why getting more heap size would hurt me, so everytime I try to put on
-Xmx1024m
It gives me the 'Failed to Create the Java Virtual Machine'
Why cant I do it and would it help me with the slow processing and rendering of visual classes?
Check out this related post that gives a lot of solutions for solving your 'Failed to Create the Java Virtual Machine' problem:
Eclipse error: 'Failed to create the Java Virtual Machine'
Besides increasing your heap, most of the time, it also helps to increase your PermGen space by using the -XX:MaxPermSize paramater. Setting this to 128m or even 256m might speed things up for you.
Check out this related post that gives a lot of solutions for solving your 'Failed to Create the Java Virtual Machine' problem: Eclipse Error: Failed To Create the Java Virtual Machine