wood burning stoves 2.0*
The moose likes IDEs, Version Control and other tools and the fly likes Increase eclipse memory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Increase eclipse memory" Watch "Increase eclipse memory" New topic
Author

Increase eclipse memory

Jeremy Wilson
Ranch Hand

Joined: Feb 18, 2003
Posts: 166
I have a very large project I am trying to clean and rebuild in the latest version of eclipse 3.0. During the compile I get a java outofmemoryerror. How do I configure eclipse to used more memory for the java compiler like setting the -X parameters for the jvm.

Thanks,
Jeremy


Jeremy Wilson
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Use the -vmargs option when starting eclipse. See http://help.eclipse.org/help21/index.jsp?topic=/org.eclipse.platform.doc.user/tasks/running_eclipse.htm


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Eric Clayberg
author
Ranch Hand

Joined: Sep 24, 2004
Posts: 63
Originally posted by Jeremy Wilson:
I have a very large project I am trying to clean and rebuild in the latest version of eclipse 3.0. During the compile I get a java outofmemoryerror. How do I configure eclipse to used more memory for the java compiler like setting the -X parameters for the jvm.

Begin by specifying the starting amount of memory (-vmargs -Xms###M) in your Application Developer/Eclipse startup command line (e.g., the target field within a Windows shortcut). If this is not specified, Eclipse's starting amount of memory is quite small (only 64MB - see http//java.sun.com/j2se/1.4.2/docs/tooldocs/windows/java.html and scroll down until you find the -Xms option description), and can really slow down your startup and initial usage time. What happens with a small starting memory like 64 MB is that the java virtual machine (and thus Eclipse)...

1) tries to use currently allocated memory (initially 64MB)

2) garbage collects several times

3) finally determines that it really needs more memory

4) allocates more memory incrementally

5) repeats this process until it reaches a steady state

If you know you are going to use at least 128 MB or more, then try specifying -Xms128M or larger as the starting memory. It should improve your startup time and initial usage prior to swapping.

If you are certain that you are going to swap, then at least try to reduce the amount of time spent garbage collecting. For example, if Application Developer/Eclipse has to live within 256 MB, then it may be spending much of its time garbage collecting which appears like swapping (application freezes or slows to a crawl for a while). You might try specifying -Xmx384M as your maximum memory usage to reduce the amount of garbage collecting. Even if you have many large applications running simultaneously, you likely use one program for a while, then switch to another, then after a while switch back. The key here is that using a program for a while and ignoring the others, plus a larger maximum memory for java (like 384 MB) lets Application Developer/Eclipse take advantage of more physical memory and garbage collect less while the other programs are swapped out. Obviously there's a trade off of maximum memory for a program versus the physical memory available... you'll have to find that "sweet spot" somewhere between 256MB and 1GB for your machine.


Eric Clayberg
Software Engineering Manager
Google
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Increase eclipse memory
 
Similar Threads
poi and protected excel book
Eclipse is leaving multiple java VMs running in memory
How to control Eclipse's memory usage
Problems running eclipse
Eclipse - memory usage