Reputation: 215
I keep getting this java.lang.OutOfMemoryError: Java heap space error in eclipse using JDK 1.6 u43 and eclipse 4.2.2 under Windows 7 64bit. I don't know what that error means or how to solve it...
Upvotes: 0
Views: 2224
Reputation: 3502
The best practice is just check your code for memory leaks and make sure yo are not leaving thousands of objects or streams without closing them or garbage collected. Simply increasing your memory limit is like avoiding the problem or escaping from what mistakes you have done . After checking the code if you think every thing is ok and still you need more memory to handle it, you can increase the heap size. Have a look here: Increasing Heap Size
http://www.ibm.com/developerworks/java/library/j-leaks/
http://www.openlogic.com/wazi/bid/188158/How-to-Fix-Memory-Leaks-in-Java
I hope it'll help you.
Upvotes: 0
Reputation: 1767
Without going into it too much the heap is a large pool of memory which stores your live variables etc during the run time of the program and as the error message suggests you are running out of it!
You can first try running eclipse with a higher maximum heap size
eclipse -vmargs -Xmx1024M
If that fixes your problem you can then change the values in the eclipse.ini file as some of the other suggestions have mentioned.
If that doesn't fix it, it is likely that you have some kind of memory leak in your program and are trying to store too many large objects in memory, in which case we would need to see code to be able to help out.
Upvotes: 1
Reputation: 2866
In the Eclipse download folder make/replace the entries in the eclipse.ini file
-Xms512m
-Xmx1024m
Upvotes: 0
Reputation: 259
Double click the Installed Jres you have installed in Eclipse, configure parameters likes below:
-Xms512M -Xmx1024M
in Default VM Arguments of your Eclipse.
This issue may resolved.
Regards!
Upvotes: 0
Reputation: 18148
You may have a memory leak, or you may be allocating large objects e.g. images all at once when you could be allocating them individually and then nulling their references, or you may simply have a program that requires a lot of memory. Try setting the -Xmx and -Xms command line parameters to something large but within your computer's capabilities, e.g. -Xmx=4096m
Upvotes: 0