0

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

Community
  • 1
  • 1
Lin Ma
  • 9,739
  • 32
  • 105
  • 175
  • 3
    Possible duplicate of [What are the best JVM settings for Eclipse?](http://stackoverflow.com/questions/142357/what-are-the-best-jvm-settings-for-eclipse) – jmj Jun 06 '16 at 18:37
  • @JigarJoshi, thanks and read through the post, it 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 you have any further thoughts, it will be great. – Lin Ma Jun 06 '16 at 19:06
  • 1
    How big is "big"? What kind of project is it? Are you also copying files when you import this project? Was it already an Eclipse project? – nitind Jun 06 '16 at 19:19
  • @nitind, vote up and I just want to import the project for leveraging the code search/highlight features of Eclipse. It is already an Eclipse project (I copied from another more powerful machine). No need for copy. Any advice is appreciated. Thanks. – Lin Ma Jun 06 '16 at 19:34
  • Edit to make it clear why the similar question is not answering what exactly I am confused in this specific question. Thanks. – Lin Ma Jun 07 '16 at 04:20

2 Answers2

1

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.

SerCe
  • 5,826
  • 2
  • 32
  • 53
  • Thanks SerCe, vote up and wondering where to set such options? Is there a GUI interface inside Eclipse IDE to setup parameters? – Lin Ma Jun 07 '16 at 17:35
1

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.

Shawn Song
  • 301
  • 1
  • 9
  • Thanks Shawn, vote up. I post my eclipse.ini file content and never edit it before, would you mind to advise me a bit more details where in my specific case to add -XX:PrintGCDetails and -Xloggc: to check the GC details? Thanks. :) – Lin Ma Jun 08 '16 at 06:21
  • 1
    its really obvious that your Xms and Xmx are way too small... I don't know how much memory you've got in your machine. If you have 4G memory, I suggest you change Xms=40m to Xms=512m and Xmx=512 to Xmx=1024m. at the end of the file, add -XX:PrintGCDetails and -Xloggc:d:/logs/gc.log make sure the logging directory is valid before you start eclipse. – Shawn Song Jun 08 '16 at 06:43
  • Thanks Shawn, vote up and tried your method (I increase Xms to 1024 and Xmx to 2048 since my machine has 16G memory), and updated my post with updated gc.log. It seems a lot of allocation error, what does it mean? If you have any further thoughts how to fix, it will be great. – Lin Ma Jun 08 '16 at 19:56
  • 1
    Allocation failures are not errors... That means your heap space is full and thus requires garbage collection. You can use jvisualvm (under jdk/bin folder) to monitor your eclipse running status. You probably want to install VisualGC plugin tool to monitor the GC performance while importing your project. – Shawn Song Jun 10 '16 at 06:34
  • Thanks Shawn, vote up for your reply and I can definitely using the monitor tools you mentioned. The question is for asking how to resolve the issue of importing big project, any tuning method in your mind is appreciated. – Lin Ma Jun 12 '16 at 23:32
  • 1
    Yeah I know. Without actually looking at your particular case its hard to guess what to tune. Use that tool when you import your big project can probably help to find some hints. Like I mentioned before it could be caused by too many GCs or it might be just an issue of IO. – Shawn Song Jun 13 '16 at 01:57
  • Thanks Shawn, vote up and for VisualGC, this is what I found so far, http://www.oracle.com/technetwork/java/visualgc-136680.html, I cannot find its related Eclipse plug-in, do you have an Eclipse plug-in installation site address? Thanks. – Lin Ma Jun 13 '16 at 22:20
  • And for jvisualvm, I have opened it and see the graphical interface, what should I do next? Using Eclipse to import the big project and see results from jvisualvm graphical interface? Do I need to specify to let jvisualvm monitor Eclipse project import operation? Thanks. – Lin Ma Jun 13 '16 at 22:25
  • 1
    VisualGC is a plugin in **VISUALVM**, not Eclipse. After you install the plugin, open eclipse and wait for it fully loaded. You should be able to see the eclipse process in visualvm UI. Then try to import the project in eclipse and monitor its running status. – Shawn Song Jun 14 '16 at 03:58
  • Thanks Shawn, vote up, is there an instruction how to install VisualGC? I am referring to this link and it seems only introduction how to use the command line options, and no installation guide. http://www.oracle.com/technetwork/java/visualgc-136680.html – Lin Ma Jun 14 '16 at 23:16
  • Another question is, why need VisualGC, VISUALVM itself is not enough? :) – Lin Ma Jun 14 '16 at 23:16
  • Thanks for all the help Shawn, mark your reply as answer. – Lin Ma Jul 27 '16 at 23:20