Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » OutOfMemory while indexing project(CDT takes a lot of memory and crashes)
OutOfMemory while indexing project [message #1072756] Tue, 23 July 2013 12:40 Go to next message
Marcelo Taube is currently offline Marcelo TaubeFriend
Messages: 7
Registered: July 2013
Junior Member
Hello,
I have been using CDT for developing C/C++ for a few years, i am quite used to the platform and think I know some quite advanced features.
Anyway I am working in a medium sized project, its only a few years old and probably less than 400 C files, each one probably around 5000 lines.
Till three months ago I worked with CDT without any problems but lately Eclipse crashes constantly on out of memory errors. I increased the heap size of the java three times from 500MB to 1.5GB but the problem still happens, i do not think the code base growed that much.
Lately i also tried filtering out many of the source directories which include code that i dont work with, I payed special attention to a few huge directories which include big self generated files and made sure they are not scanned by CDT.
That last move improved the speed of indexing significantly and also made the memory problems be less frequent but did not fix the whole mess up. If previouslly it would crash immediately while indexing now it fails in other places. While indexing I also seen many times that the OutOfMemory happened inside some function called UpdateManager.
I noticed for example eclipse crashing when changing configuration or renaming a variable.
To see if it helps, I also upgraded from Juno to the current version of Kepler, but the problem still happens.

Some more details of my system:
> workspace and project placed in my home directory over nfs
> Using git as a source control and using egit in eclipse to see history/annotations
> I recall that a few months ago i tried installed python plugin in eclipse and had to remove it because it made eclipse crash immediately
> My desktop has 4GB of memory, eclipse is the highest consumer of memory, typically i have the main memory not completely used and swap space is free

Here is the log CDT prints after indexing successfully:
Quote:
!MESSAGE Indexed 'myproject' (352 sources, 762 headers) in 26.52 sec: 130,142 declarations; 581,823 references; 348 unresolved inclusions; 3,191 syntax errors; 19,791 unresolved names (2.70%)


Attached a stack trace of one of the last crashes and the contents of the configuration tab in the about window of eclipse.

Thanks for any help in finding the solution
Marcelo Taube

Re: OutOfMemory while indexing project [message #1073215 is a reply to message #1072756] Wed, 24 July 2013 10:39 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
Are you're sure that you increased the heap space? I don't see any Xmx parameter in your system configuration. You need to change the value in eclipse_instdir/eclipse.ini

Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: OutOfMemory while indexing project [message #1073257 is a reply to message #1073215] Wed, 24 July 2013 12:12 Go to previous messageGo to next message
Marcelo Taube is currently offline Marcelo TaubeFriend
Messages: 7
Registered: July 2013
Junior Member
This is my eclipse.ini file in the same directory where kepler is installed

-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20130521-0416
-product
org.eclipse.epp.package.cpp.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.6
-XX:MaxPermSize=256m
-Xms40m
-Xmx1500m
-Djava.net.preferIPv4Stack=true
Re: OutOfMemory while indexing project [message #1073389 is a reply to message #1073257] Wed, 24 July 2013 17:04 Go to previous messageGo to next message
David Wegener is currently offline David WegenerFriend
Messages: 1352
Registered: July 2009
Senior Member
The stack trace indicates you are running out of permgen space not heap space. You will need to try increasing the permgen size. I don't know how to do that exactly, but I know that it involves manipulating the XXMaxPermSize parameters in your eclipse.ini

This faq might help.
http://wiki.eclipse.org/FAQ_How_do_I_increase_the_permgen_size_available_to_Eclipse%3F
Re: OutOfMemory while indexing project [message #1073675 is a reply to message #1073389] Thu, 25 July 2013 09:26 Go to previous messageGo to next message
Marcelo Taube is currently offline Marcelo TaubeFriend
Messages: 7
Registered: July 2013
Junior Member
Thank you much. Will look into that and tell you if it helped.

By the way, when eclipse dies it pop us a window saying this:

Quote:
JVM terminated. Exit code=13
/usr/bin/java
-jar /usr/local/kepler/plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
-os linux
-ws gtk
-arch x86_64
-showsplash
-launcher /usr/local/kepler/kepler
-name Kepler
--launcher.library /usr/local/kepler/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20130521-0416/eclipse_1506.so
-startup /usr/local/kepler/plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
--launcher.overrideVmargs
-exitdata 1820011
-vm /usr/bin/java
-vmargs
-jar /usr/local/kepler/plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar


What is strange about that is that it does not show the extra vmargs I added in eclipse.ini . Is that normal?
Re: OutOfMemory while indexing project [message #1073779 is a reply to message #1073389] Thu, 25 July 2013 13:20 Go to previous messageGo to next message
Marcelo Taube is currently offline Marcelo TaubeFriend
Messages: 7
Registered: July 2013
Junior Member
David,
by the way, i think XXMaxPermSize might have helped but its still happening every half an hour.
I have to rerun kepler.

Just so you know, I now checked out the nightly build of CDT, installed it but the error still happens Sad
Re: OutOfMemory while indexing project [message #1074129 is a reply to message #1073675] Fri, 26 July 2013 07:06 Go to previous messageGo to next message
Anton Leherbauer is currently offline Anton LeherbauerFriend
Messages: 490
Registered: July 2009
Senior Member
Quote:
What is strange about that is that it does not show the extra vmargs I added in eclipse.ini . Is that normal?


That's exactly the problem. The launcher ignores the vmargs from the .ini file because of --launcher.overrideVmargs.
You should try to find out where this is coming from or specify the vmargs on the command line.
Re: OutOfMemory while indexing project [message #1075360 is a reply to message #1074129] Mon, 29 July 2013 09:46 Go to previous messageGo to next message
Marcelo Taube is currently offline Marcelo TaubeFriend
Messages: 7
Registered: July 2013
Junior Member
Found the main source of the problem which made CDT difficulties parsing.

There was a line like this:
#define MAX_OBJECTS MAX(1, MAX( 1, MAX( 1, MAX( 1, MAX( 4, MAX( 2, MAX( 1, MAX( 1, MAX( 33, MAX( 4, MAX( 1, MAX( 1, MAX( 2, MAX( 2, MAX( 2, MAX( 2, MAX( 2, MAX( 1, 1 ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )
int numbers[MAX_OBJECTS];
The preprocessor was generating a line of 4.7 million chars, and I guess CDT was having the same problem itself.

I fixed the code by changing all this to 33 directly.
But, it sounds there could be solutions to this kind of problem, there might be some heuristic CDT would like to implement to parse this.
Re: OutOfMemory while indexing project [message #1075377 is a reply to message #1074129] Mon, 29 July 2013 10:22 Go to previous messageGo to next message
Marcelo Taube is currently offline Marcelo TaubeFriend
Messages: 7
Registered: July 2013
Junior Member
Anton,

This is the standard Kepler downloaded from eclipse.org.
I just run the eclipse file from the eclipse directory and trusted it would read eclipse.ini
I see the eclipse process adds the --launcher.overrideVmargs parameter when running java but i have not idea how could this happen.
Any ideas?
Re: OutOfMemory while indexing project [message #1075931 is a reply to message #1075377] Tue, 30 July 2013 10:53 Go to previous message
Marcelo Taube is currently offline Marcelo TaubeFriend
Messages: 7
Registered: July 2013
Junior Member
Finally understood the mistery.
Previouslly i could not understand why eclipse.ini was not being read. The answer is that i renamed the executable name from eclipse to kepler just to be sure not to execute the wrong version, so the launcher was searching for a file named like the executable, i.e. kepler.ini instead of eclipse.ini.
Instead of using eclipse.ini it was using the standard values.
Thanks to everyone that helped.
Marcelo
Previous Topic:No Loadable sections found in added symbol-file
Next Topic:Indexer Problem(?)
Goto Forum:
  


Current Time: Mon Dec 22 10:05:07 GMT 2014

Powered by FUDForum. Page generated in 0.03611 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software