Lin Ma
Lin Ma

Reputation: 10149

loading big project in Eclipse

I found it is always very slow or hang when using Eclipse to import a big project. Are there any recommended tricks? I heard there is a way to tune heap size of Eclipse, and wondering more details. Thanks.

my question is different from that question, since that question covers very specific setting for specific version of Eclipse. I am using Eclipse 4.4.1 and not found it is covered in that post. If anyone have any further thoughts, it will be great.

Post my eclipse.ini file,

-startup
../../../plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
--launcher.library
../../../plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.200.v20140603-1326
-product
org.eclipse.epp.package.standard.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vm
/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/bin/java
-vmargs
-Dosgi.requiredJavaVersion=1.7
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts
-Xms40m
-Xmx512m
-Xdock:icon=../Resources/Eclipse.icns
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts

Errors found from gc,

Java HotSpot(TM) 64-Bit Server VM (25.5-b02) for bsd-amd64 JRE (1.8.0_05-b13), built on Mar 18 2014 00:36:13 by "java_re" with gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Memory: 4k page, physical 16777216k(1263060k free)

/proc/meminfo:

CommandLine flags: -XX:InitialHeapSize=1073741824 -XX:MaxHeapSize=2147483648 -XX:+PrintGC -XX:+PrintGCTimeStamps -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseParallelGC 
0.069: [GC (Allocation Failure)  512K->456K(1048064K), 0.0012740 secs]
0.100: [GC (Allocation Failure)  967K->552K(1048576K), 0.0007710 secs]
0.142: [GC (Allocation Failure)  1576K->887K(1048576K), 0.0010520 secs]
0.170: [GC (Allocation Failure)  1911K->1145K(1049600K), 0.0011690 secs]
0.259: [GC (Allocation Failure)  3154K->1711K(1049600K), 0.0015070 secs]
0.307: [GC (Allocation Failure)  3759K->2198K(1052672K), 0.0013960 secs]
0.374: [GC (Allocation Failure)  6294K->2847K(1052672K), 0.0022820 secs]
0.510: [GC (Allocation Failure)  6934K->3982K(1055744K), 0.0152520 secs]
0.604: [GC (Allocation Failure)  11150K->6772K(1056768K), 0.0071190 secs]
0.646: [GC (Allocation Failure)  13940K->9925K(1060864K), 0.0099910 secs]
0.710: [GC (Allocation Failure)  20165K->14445K(1062400K), 0.0131930 secs]
1.045: [GC (Allocation Failure)  24685K->16812K(1069056K), 0.0078650 secs]
1.263: [GC (Allocation Failure)  33196K->19905K(1069056K), 0.0037050 secs]
1.429: [GC (Allocation Failure)  36289K->20490K(1079808K), 0.0040400 secs]
1.985: [GC (Allocation Failure)  47114K->21536K(1079808K), 0.0063240 secs]
3.218: [GC (Allocation Failure)  48160K->27304K(1094656K), 0.0121460 secs]

regards, Lin

Upvotes: 0

Views: 319

Answers (2)

Shawn Song
Shawn Song

Reputation: 301

I suggest you to put on some JVM debugging options in your eclipse.ini file. You can use -XX:PrintGCDetails and -Xloggc: to check the GC details. Maybe there are too many Full GCs. If that's the case, the next step should be helpful.

You also might want to increase the initial heap size to -Xms512m so it allocates more memory at start. -XX:NewRatio might be helpful if your Eden space is too small, which will cause a lot minor GC.

Changing Garbage Collector might be another option but I believe the default one is most suitable for java desktop applications.

Upvotes: 1

Sergey Tselovalnikov
Sergey Tselovalnikov

Reputation: 6036

It is a very tricky question. You can try to find the best JVM options for your case, as mentioned in the comment above.

Another option is to try Eclipse Optimizer made by Zeroturnaround. It will try to diagnose and fix some issues in your Eclipse installation.

Upvotes: 1

Related Questions