by, 11-02-2011 at 07:13 PM (915 Views)
You might have encountered OutOfMemoryException using Eclipse. This post is about solving this issue.
OutOfMemoryException is caused by too little heap space for virtual machine. Adjusting the maximum heap space with something like -vmargs -Xmx256m works. This gives your Java apps more space to run and this always helps performance. There are situations where even with an enormous heap size you can still end up with OutOfMemoryException. This means that your VM is not running out of heap space, but is instead running out of permSpace. Let me tell you about permSpace. The VM's permSpace is the area of the VM that is used to store data structures and class information (not instances, but the class definitions themselves).
In the case of a large enough Java application that may contain 10s of thousands of class files that must be loaded you start to see how the VM can physically run out of space storing all of that information into the default permSpace . If you have run into a situation where you have run out of permSpace you will want to adjust your Eclipse shortcut, eclipse.ini , or startup script to include the argument -XX:MaxPermSize=64m ; generally speaking the more memory you give the VM, the more performant it will be. Tuning this value can help you find what works best for your Eclipse install.