Nemesis
Nemesis

Reputation: 121

Optimizing Eclipse

I am using eclipse IDE for Java EE
Version: 4.3.2
Build id: M20140221-1700

My Compaq Laptop is a Core i3 M350 @ 2.27 Ghz with 8GB RAM running on windows 8.1 Pro 64bit.
And The JDK version is 1.7.0_40 64bit

I have disabled the validation check and the spell check but I have still noticed the IDE is lagging a lot and it freezes most of the time.

the eclipse.ini file is:

-vm
C:\Java\jdk1.7.0_40\jre\bin\server\jvm.dll
-vmargs
-Xincgc
-Xss500k
-Dosgi.requiredJavaVersion=1.7
-Xms128m
-Xmx768m
-XX:NewSize=8m
-XX:PermSize=512m
-XX:MaxPermSize=1024m
-XX:MaxPermHeapExpansion=10m
-XX:+UseConcMarkSweepGC
-XX:CMSInitiatingOccupancyFraction=70
-XX:+UseCMSInitiatingOccupancyOnly
-XX:+UseParNewGC
-XX:+CMSConcurrentMTEnabled
-XX:ConcGCThreads=2
-XX:ParallelGCThreads=2
-XX:+CMSIncrementalPacing
-XX:CMSIncrementalDutyCycleMin=0
-XX:CMSIncrementalDutyCycle=5
-XX:GCTimeRatio=49
-XX:MaxGCPauseMillis=20
-XX:GCPauseIntervalMillis=1000
-XX:+UseCMSCompactAtFullCollection
-XX:+CMSClassUnloadingEnabled
-XX:+DoEscapeAnalysis
-XX:+UseCompressedOops
-XX:+AggressiveOpts


What would be the best eclipse.ini setting for me?

--UPDATE--
a copy of the workspace log file:

!SESSION 2014-04-21 18:23:18.129 -----------------------------------------------
eclipse.buildId=4.3.2.M20140221-1700
java.version=1.7.0_40
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Command-line arguments:  -os win32 -ws win32 -arch x86_64

!ENTRY org.eclipse.egit.ui 2 0 2014-04-21 18:23:31.716
!MESSAGE Warning: EGit couldn't detect the installation path "gitPrefix" of native Git. Hence EGit can't respect system level
Git settings which might be configured in ${gitPrefix}/etc/gitconfig under the native Git installation directory.
The most important of these settings is core.autocrlf. Git for Windows by default sets this parameter to true in
this system level configuration. The Git installation location can be configured on the
Team > Git > Configuration preference page's 'System Settings' tab.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.

!ENTRY org.eclipse.egit.ui 2 0 2014-04-21 18:23:31.743
!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git
user global configuration and to define the default location to store repositories: 'C:\Users\Amin'. If this is
not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and
EGit might behave differently since they see different configuration options.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.

!ENTRY org.eclipse.jst.jsp.core 4 4 2014-04-21 18:23:42.500
!MESSAGE A workspace crash was detected. The previous session did not exit normally. Not using saved taglib indexes.

!ENTRY org.eclipse.core.jobs 4 2 2014-04-21 18:44:46.343
!MESSAGE An internal error occurred during: "Compacting resource model".
!STACK 0
java.lang.OutOfMemoryError: Java heap space
    at java.util.HashMap.addEntry(HashMap.java:799)
    at java.util.HashMap.put(HashMap.java:412)
    at org.eclipse.core.internal.utils.StringPool.add(StringPool.java:54)
    at org.eclipse.core.internal.dtree.AbstractDataTreeNode.storeStrings(AbstractDataTreeNode.java:575)
    at org.eclipse.core.internal.dtree.DataTreeNode.storeStrings(DataTreeNode.java:338)
    at org.eclipse.core.internal.dtree.AbstractDataTreeNode.storeStrings(AbstractDataTreeNode.java:580)
    at org.eclipse.core.internal.dtree.DataTreeNode.storeStrings(DataTreeNode.java:338)
    at org.eclipse.core.internal.dtree.AbstractDataTreeNode.storeStrings(AbstractDataTreeNode.java:580)
    at org.eclipse.core.internal.dtree.DataTreeNode.storeStrings(DataTreeNode.java:338)
    at org.eclipse.core.internal.dtree.AbstractDataTreeNode.storeStrings(AbstractDataTreeNode.java:580)
    at org.eclipse.core.internal.dtree.DataTreeNode.storeStrings(DataTreeNode.java:338)
    at org.eclipse.core.internal.dtree.AbstractDataTreeNode.storeStrings(AbstractDataTreeNode.java:580)
    at org.eclipse.core.internal.dtree.DataTreeNode.storeStrings(DataTreeNode.java:338)
    at org.eclipse.core.internal.dtree.AbstractDataTreeNode.storeStrings(AbstractDataTreeNode.java:580)
    at org.eclipse.core.internal.dtree.DataTreeNode.storeStrings(DataTreeNode.java:338)
    at org.eclipse.core.internal.dtree.DeltaDataTree.storeStrings(DeltaDataTree.java:956)
    at org.eclipse.core.internal.watson.ElementTree.shareStrings(ElementTree.java:707)
    at org.eclipse.core.internal.resources.SaveManager.shareStrings(SaveManager.java:1383)
    at org.eclipse.core.internal.utils.StringPoolJob$1.run(StringPoolJob.java:131)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.utils.StringPoolJob.shareStrings(StringPoolJob.java:125)
    at org.eclipse.core.internal.utils.StringPoolJob.run(StringPoolJob.java:102)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

!ENTRY org.eclipse.core.jobs 4 2 2014-04-21 18:44:50.985
!MESSAGE An internal error occurred during: "JSP Index Manager: Processing Resource Events".
!STACK 0
java.lang.OutOfMemoryError: Java heap space

!ENTRY org.eclipse.core.jobs 4 2 2014-04-21 18:44:54.450
!MESSAGE An internal error occurred during: "Workbench Auto-Save Background Job".
!STACK 0
java.lang.OutOfMemoryError: Java heap space
    at org.eclipse.emf.ecore.util.EContentsEList.newNonResolvingListIterator(EContentsEList.java:92)
    at org.eclipse.emf.ecore.util.EContentsEList.basicIterator(EContentsEList.java:269)
    at org.eclipse.emf.ecore.util.EcoreUtil$ProperContentIterator.<init>(EcoreUtil.java:1294)
    at org.eclipse.emf.ecore.util.EcoreUtil$4.getChildren(EcoreUtil.java:1201)
    at org.eclipse.emf.common.util.AbstractTreeIterator.next(AbstractTreeIterator.java:138)
    at org.eclipse.emf.ecore.resource.impl.ResourceImpl.attached(ResourceImpl.java:846)
    at org.eclipse.emf.ecore.resource.impl.ResourceImpl$ContentsEList.inverseAdd(ResourceImpl.java:411)
    at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:312)
    at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:303)
    at org.eclipse.e4.ui.internal.workbench.ResourceHandler.createResourceWithApp(ResourceHandler.java:239)
    at org.eclipse.ui.internal.Workbench$18.run(Workbench.java:1218)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)


Upvotes: 2

Views: 4030

Answers (2)

Nemesis
Nemesis

Reputation: 121

The main issue was cause by the extra huge size of the Project (+54K files).

I had checkout the project from a wrong branch. so now I have the correct branch and I'm using it.

So far eclipse has worked OK without crashing.

Anyways thanks for your help.

My new eclipse.ini setting is:

-vm
C:\Java\jdk1.7.0_40\jre\bin\server\jvm.dll
-vmargs
-Xincgc
-Xss500k
-Dosgi.requiredJavaVersion=1.7
-Xms1024m
-Xmx2048m
-XX:NewSize=8m
-XX:PermSize=512m
-XX:MaxPermSize=1024m
-XX:MaxPermHeapExpansion=10m
-XX:+UseConcMarkSweepGC
-XX:CMSInitiatingOccupancyFraction=70
-XX:+UseCMSInitiatingOccupancyOnly
-XX:+UseParNewGC
-XX:+CMSConcurrentMTEnabled
-XX:ConcGCThreads=2
-XX:ParallelGCThreads=2
-XX:+CMSIncrementalPacing
-XX:CMSIncrementalDutyCycleMin=0
-XX:CMSIncrementalDutyCycle=5
-XX:GCTimeRatio=49
-XX:MaxGCPauseMillis=20
-XX:GCPauseIntervalMillis=1000
-XX:+UseCMSCompactAtFullCollection
-XX:+CMSClassUnloadingEnabled
-XX:+DoEscapeAnalysis
-XX:+UseCompressedOops
-XX:+AggressiveOpts
-XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses

Upvotes: 1

Stephen C
Stephen C

Reputation: 718658

Lots of pauses / freezes in Eclipse is often a sign that the JVM's garbage collector is struggling. And the java.lang.OutOfMemoryError: Java heap space exceptions explain why. Your Eclipse is (was) on the brink of running out of heap, and the JVM was most likely running lots of "full" garbage collections in an attempt to keep Eclipse running.

You solved the problem one way ... by reducing the total size of the projects you had open.

Another solution is to increase the Eclipse JVM heap size, by changing the -Xmx option. Assuming that your system has enough physical memory, it pays to be generous with the amount of heap space you give to Eclipse. Conversely, no amount of fiddling with the other GC parameters will help much if the real problem is that your heap is too small ...

Upvotes: 2

Related Questions