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.
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
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.