19

I'm working on some legacy C++ code written using "vi" and "emacs" and I am trying to build an eclipse CDT setup to maintain it (on linux). The two main problems I've been facing are that the indexing takes very long (over 4h) and that even once that's finished, eclipse is barely responsive.

The code base is structured in a "3-4 level deep" manner:

/system/${category}/${library}/
/server/${serverName}/${component}/

Example:

/system/CORE/CommandLine/*.cpp
/system/CORE/Connection/*.cpp
...
/server/Authentication/DB/Objects/*.cpp
/server/Authentication/Main/*.cpp

There are about 200 "modules" under /system/* and around 50 under /server/Authentication/*. There is also an amazingly convoluted make system with 20 years worth of make-code written by people who wanted to showoff their make abilities :-)

I've tried two approaches so far

1) Two eclipse cdt projects, namely /system and /Authentication

2) One eclipse cdt project per "module" ending up with +200 modules. I even calculated dependencies between modules.

In both approaches, indexing takes very long. On approach 1) I get quite a few problems with non-resolved dependencies. With approach 2) eclipse is barely responsive, when I ctrl+click a function I can go for a coffee and come back before it responds...

Anyone out there has worked with big projects like these? What do you suggest?

krico
  • 5,723
  • 2
  • 25
  • 28

3 Answers3

20

General recommendation here is to provide more RAM for Eclipse. First, you will need to tweak your eclipse.ini configuration file as the default one is not suitable for big projects. Here is my eclipse.ini file:

-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502
-product
org.eclipse.epp.package.cpp.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms512M 
-Xmx4096M 
-XX:PermSize=256M 
-XX:MaxPermSize=512M

Here I used -Xmx4096M to provide 4Gb of RAM.

To improve responsiveness you will also need to configure Indexer Cache limits. I recommend to increase all parameters by 2-3 times, depending on project size.

ks1322
  • 33,961
  • 14
  • 109
  • 164
  • This is certainly good recommendations. I didn't mention this, but I had changed both my -Xmx and the Indexer Cache Limits already. I guess there is not much else to do :-( – krico Mar 11 '12 at 13:41
  • Ok, I have nothing more to recommend, though without these settings my project indexing takes a long as you described. My project is also big. – ks1322 Mar 13 '12 at 08:11
  • [I had to use 16 GiB: `-Xmx16384m`](https://stackoverflow.com/a/69924563/4561887). – Gabriel Staples Nov 11 '21 at 07:29
1

Using the Project resource filters helped me a lot. I removed from the project tree folders which I didn't want either to modify or to submit to indexing.

To create a new filter just right click on the project and then open the Properties panel then reach Resource -> Resource Filters

http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.user/concepts/resourcefilters.htm

Sometimes if your project sources are too big (ex: about 5GB ) you need to use a filter otherwise the indexing process never end correctly.

Bemipefe
  • 1,397
  • 4
  • 17
  • 30
0

-Xss8g on eclipse.ini was also needed on Neon to prevent stack overflow.

Also consider ulimit -Sv unlimited.

Tested on Ubuntu 14.04.

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
  • `ulimit -Sv` means removing any (soft) limit on the amount of virtual memory available to the shell (and its children probably). But - are you sure a 8 gigabyte stack is a good idea? – einpoklum Sep 17 '20 at 21:22
  • @einpoklum let me know if you are aware of any downsides to large stacks. I have 32GB RAM. And with swap turned off, worst case OOM should make a visit I think even if you blow your RAM. With swap could go into swap slowdown madness mode. – Ciro Santilli OurBigBook.com Sep 17 '20 at 21:51