Wednesday, July 21, 2010

Eclipse getting Out of Memory

I installed latest version of JDK 1.6.21 and latest eclipse Halilos version to Windows 7 (32bit). Eclipse started crashing again and again after few minutes, giving me the out of Memory issue in logs.




Here is the exception log:


!ENTRY org.eclipse.ui 4 0 2010-07-21 09:08:30.662
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:165)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:554)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:524)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:455)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_LockClassLoader(ClasspathManager.java:443)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:423)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:193)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(BundleLoader.java:370)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:446)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:399)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:387)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:87)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at org.eclipse.wst.sse.ui.StructuredTextEditor.createActions(StructuredTextEditor.java:1277)
at org.eclipse.ui.texteditor.AbstractTextEditor.createPartControl(AbstractTextEditor.java:3362)
at org.eclipse.ui.texteditor.StatusTextEditor.createPartControl(StatusTextEditor.java:53)
at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.createPartControl(AbstractDecoratedTextEditor.java:394)
at org.eclipse.wst.sse.ui.StructuredTextEditor.createPartControl(StructuredTextEditor.java:1362)
at org.eclipse.ui.part.MultiPageEditorPart.addPage(MultiPageEditorPart.java:217)
at org.eclipse.ui.part.MultiPageEditorPart.addPage(MultiPageEditorPart.java:187)
at org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart.addSourcePage(XMLMultiPageEditorPart.java:435)
at org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart.createPages(XMLMultiPageEditorPart.java:605)
at org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:310)
at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:661)
at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:428)
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:594)
at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:306)
at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180)
at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270)

Solution:

After struggling with this, I found this issue is due to the latest JDK v1.6.21. Best is to use the stable version of JDK that is: JDK v 1.6.20 and configure it accordingly.
Hopefully it will resolve the issue, if still getting the issue add following line after "-vmargs" to your eclipse.ini file:
-XX:MaxPermSize=256m
The eclipse.ini file can be found under eclipse directory. It will be someting like this:

eclipse.ini
---------------
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
512M

-framework

plugins\org.eclipse.osgi_3.4.3.R34x_v20081215-1030.jar

-vm

C:\Program Files\Java\jdk1.5.0_22\bin

-vmargs

-XX:MaxPermSize=512m

-Dosgi.requiredJavaVersion=1.5

-Xms128m

-Xmx1024m

---------------

No comments: