Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Eclipse-CDT startup error "Java heap space"
Eclipse-CDT startup error "Java heap space" [message #872041] Tue, 15 May 2012 11:07 Go to next message
Nicholas Lee is currently offline Nicholas LeeFriend
Messages: 5
Registered: May 2012
Junior Member
I have freshly installed Ubuntu 12.04 LTS on a PC with 6GB of RAM.
I then installed Eclipse Indigo and then the CDT addon.

When I start the Eclipse-CDT IDE it immediately crashes with the following message:

'Project Explorer' has encountered a problem
An internal error has occured
Java heap space




Here is the log...


java.lang.OutOfMemoryError: Java heap space
at org.eclipse.ui.part.ResourceTransfer.nativeToJava(ResourceTransfer.java:162)
at org.eclipse.swt.dnd.Clipboard.getContents(Clipboard.java:323)
at org.eclipse.swt.dnd.Clipboard.getContents(Clipboard.java:241)
at org.eclipse.cdt.internal.ui.cview.PasteAction$1.run(PasteAction.java:174)
at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:180)
at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
at org.eclipse.swt.widgets.Display.syncExec(Display.java:4330)
at org.eclipse.cdt.internal.ui.cview.PasteAction.updateSelection(PasteAction.java:170)
at org.eclipse.ui.actions.BaseSelectionListenerAction.selectionChangedBaseSelectionListenerAction.java:124)
at org.eclipse.cdt.internal.ui.cview.RefactorActionGroup.updateActionBarsRefactorActionGroup.java:149)
at org.eclipse.cdt.internal.ui.cview.MainActionGroup.updateActionBarsMainActionGroup.java:313)
at org.eclipse.cdt.internal.ui.cview.CView.updateActionBars(CView.java:779)
at org.eclipse.cdt.internal.ui.cview.CView.createPartControl(CView.java:554)
at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:375)
at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:229)
at org.eclipse.ui.internal.WorkbenchPartReference.getPartWorkbenchPartReference.java:595)
at org.eclipse.ui.internal.Perspective.showView(Perspective.java:2245)
at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:1145)
at org.eclipse.ui.internal.WorkbenchPage$20.run(WorkbenchPage.java:3921)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:3918)
at org.eclipse.ui.handlers.ShowViewHandler.openView(ShowViewHandler.java:162)
at org.eclipse.ui.handlers.ShowViewHandler.execute(ShowViewHandler.java:76)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecksParameterizedCommand.java:508)
at org.eclipse.ui.internal.handlers.HandlerService.executeCommandHandlerService.java:169)
at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommandSlaveHandlerService.java:241)
at org.eclipse.ui.menus.CommandContributionItem.handleWidgetSelectionCommandContributionItem.java:829)
at org.eclipse.ui.menus.CommandContributionItem.access$19CommandContributionItem.java:815)
at org.eclipse.ui.menus.CommandContributionItem$5.handleEventCommandContributionItem.java:805)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)


Here is the session data...

eclipse.buildId=I20110613-1736
java.version=1.7.0_03
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_GB
Command-line arguments: -os linux -ws gtk -arch x86



I have tried increasing the Java Heap space, but this did not help.
I even tried a upgrading the Java version to 1.7, but there was no improvement.

Here is the contents of my /etc/eclipse.ini file


-startup
plugins/org.eclipse.equinox.launcher_1.2.0.dist.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.100.dist
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
512m
--launcher.defaultAction
openFile
-vmargs
-Xms512m
-Xmx1024m
-XX:MaxPermSize=512M
-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=/usr/share/eclipse/dropins

-XX:-UseCompressedOops


NB: Whilst this may be a red-herring, I access this headless PC using VNC.

NB: I also see the following error in the logs...



String index out of range: -7


java.lang.StringIndexOutOfBoundsException: String index out of range: -7
at java.lang.String.substring(String.java:1949)
at java.lang.String.substring(String.java:1916)
at org.eclipse.cdt.managedbuilder.internal.core.AdditionalInput$1LibFilter.acceptAdditionalInput.java:488)
at org.eclipse.cdt.managedbuilder.internal.core.AdditionalInput.findLibraryAdditionalInput.java:522)
at org.eclipse.cdt.managedbuilder.internal.core.AdditionalInput.getDepLibsAdditionalInput.java:457)
at org.eclipse.cdt.managedbuilder.internal.core.AdditionalInput.dependencyChangedAdditionalInput.java:405)
at org.eclipse.cdt.managedbuilder.internal.core.AdditionalInput.needsRebuildAdditionalInput.java:343)
at org.eclipse.cdt.managedbuilder.internal.core.InputType.needsRebuildInputType.java:1619)
at org.eclipse.cdt.managedbuilder.internal.core.Tool.needsRebuild(Tool.java:3307)
at org.eclipse.cdt.managedbuilder.internal.core.ToolChain.needsRebuildToolChain.java:2068)
at org.eclipse.cdt.managedbuilder.internal.core.ToolChain.saveRebuildStateToolChain.java:2101)
at org.eclipse.cdt.managedbuilder.internal.core.ToolChain.serialize(ToolChain.java:872)
at org.eclipse.cdt.managedbuilder.internal.core.FolderInfo.serialize(FolderInfo.java:385)
at org.eclipse.cdt.managedbuilder.internal.core.Configuration.serializeConfiguration.java:953)
at org.eclipse.cdt.managedbuilder.internal.dataprovider.ConfigurationDataProvider.writeConfigurationConfigurationDataProvider.java:124)
at org.eclipse.cdt.managedbuilder.internal.dataprovider.ConfigurationDataProvider.applyConfigurationConfigurationDataProvider.java:162)
at org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager.applyDataCProjectDescriptionManager.java:1124)
at org.eclipse.cdt.internal.core.settings.model.CConfigurationDescriptionCache.applyDataCConfigurationDescriptionCache.java:137)
at org.eclipse.cdt.internal.core.settings.model.CProjectDescription.applyDatasCProjectDescription.java:218)
at org.eclipse.cdt.internal.core.settings.model.SetCProjectDescriptionOperation.executeOperationSetCProjectDescriptionOperation.java:97)
at org.eclipse.cdt.internal.core.model.CModelOperation.execute(CModelOperation.java:339)
at org.eclipse.cdt.internal.core.model.CModelOperation.run(CModelOperation.java:602)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
at org.eclipse.cdt.internal.core.model.CModelOperation.runOperationCModelOperation.java:633)
at org.eclipse.cdt.internal.core.settings.model.AbstractCProjectDescriptionStorage.setProjectDescriptionAbstractCProjectDescriptionStorage.java:203)
at org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionStorageManager.setProjectDescriptionCProjectDescriptionStorageManager.java:149)
at rg.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager.setProjectDescriptionCProjectDescriptionManager.java:836)
at org.eclipse.cdt.managedbuilder.internal.core.BuildSettingsUtil.checkApplyDescriptionBuildSettingsUtil.java:211)
at org.eclipse.cdt.managedbuilder.core.ManagedBuildManager.updateCoreSettingsManagedBuildManager.java:1561)
at org.eclipse.cdt.build.internal.core.scannerconfig.CfgDiscoveredPathManager$1.runCfgDiscoveredPathManager.java:152)
at org.eclipse.cdt.internal.core.model.BatchOperation.executeOperationBatchOperation.java:36)
at org.eclipse.cdt.internal.core.model.CModelOperation.execute(CModelOperation.java:339)
at org.eclipse.cdt.internal.core.model.CModelOperation.run(CModelOperation.java:602)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
at org.eclipse.cdt.core.model.CoreModel.run(CoreModel.java:1233)
at org.eclipse.cdt.core.model.CoreModel.run(CoreModel.java:1190)
at org.eclipse.cdt.build.internal.core.scannerconfig.CfgDiscoveredPathManager.updateCoreSettingsCfgDiscoveredPathManager.java:155)
at org.eclipse.cdt.build.core.scannerconfig.ScannerConfigBuilder.buildScannerConfigBuilder.java:124)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)



Regards,
Nicholas Lee
Re: Eclipse-CDT startup error "Java heap space" [message #875310 is a reply to message #872041] Tue, 22 May 2012 13:58 Go to previous messageGo to next message
Nicholas Lee is currently offline Nicholas LeeFriend
Messages: 5
Registered: May 2012
Junior Member
As a follow-up, I have found that the problem goes away if I disable clipboard transfers for my VNC session.

In some way Eclipse CDT is sensitive to these VNC settings and causes it to Java Heap OOM crash on startup.

No other applications I have tried are affected by the VNC clipboard settings, so I still consider this to be an Eclipse CDT bug.

It is annoying to have to disable clipboard transfers as this is a useful feature.

Re: Eclipse-CDT startup error "Java heap space" [message #876006 is a reply to message #875310] Wed, 23 May 2012 18:13 Go to previous messageGo to next message
Yevgeny Shifrin is currently offline Yevgeny ShifrinFriend
Messages: 207
Registered: July 2009
Senior Member
If you think it is Eclipse CDT bug, you can open a ticket (https://bugs.eclipse.org/bugs/query.cgi?product=CDT). This way it could be solved for future releases Smile
Re: Eclipse-CDT startup error "Java heap space" [message #876388 is a reply to message #875310] Thu, 24 May 2012 13:53 Go to previous messageGo to next message
Andrea is currently offline AndreaFriend
Messages: 27
Registered: July 2009
Junior Member
On 05/22/2012 03:58 PM, Nicholas Lee wrote:
> As a follow-up, I have found that the problem goes away if I disable
> clipboard transfers for my VNC session.
>
> In some way Eclipse CDT is sensitive to these VNC settings and causes it
> to Java Heap OOM crash on startup.
>
> No other applications I have tried are affected by the VNC clipboard
> settings, so I still consider this to be an Eclipse CDT bug.
>
> It is annoying to have to disable clipboard transfers as this is a
> useful feature.
>
>

change the value of Xmx in your eclipse.ini as specified here:

http://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html#nonstandard
Re: Eclipse-CDT startup error "Java heap space" [message #876787 is a reply to message #876388] Fri, 25 May 2012 09:28 Go to previous messageGo to next message
Nicholas Lee is currently offline Nicholas LeeFriend
Messages: 5
Registered: May 2012
Junior Member
Thanks, but like I said in my original post "I have tried increasing the Java Heap space, but this did not help."

You will note that the default values for eclipse are..
-Xms40m
-Xmx512m

and that my eclipse.ini has already increased them to...

-Xms512m
-Xmx1024m

I can even give it 2GB or even 4GB and it doesn't help; and it shouldn't need anything like those numbers just to start Eclipse CDT.

If eclipse is trying to do something like allocate a 2's complement negative amount of memory (e.g. "-1" = (2^31)-1 = 2147483647 bytes) of memory due to some clipboard string length miscalculation, then no amount of increasing the Java heap space is going to fix that.
Indeed, this is the symptom that we observe. Eclipse fails OOM immediately upon startup and no extra amount of adding Java heap space helps.
Re: Eclipse-CDT startup error "Java heap space" [message #876799 is a reply to message #876006] Fri, 25 May 2012 09:49 Go to previous messageGo to next message
Nicholas Lee is currently offline Nicholas LeeFriend
Messages: 5
Registered: May 2012
Junior Member
Done!

Bug 380631 has been added to the database
Re: Eclipse-CDT startup error "Java heap space" [message #876838 is a reply to message #875310] Fri, 25 May 2012 11:11 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
Nicholas Lee wrote on Tue, 22 May 2012 15:58
As a follow-up, I have found that the problem goes away if I disable clipboard transfers for my VNC session.

In some way Eclipse CDT is sensitive to these VNC settings and causes it to Java Heap OOM crash on startup.

No other applications I have tried are affected by the VNC clipboard settings, so I still consider this to be an Eclipse CDT bug.

It is annoying to have to disable clipboard transfers as this is a useful feature.


Here is a similar bug report. They indicated another workaround.


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Eclipse-CDT startup error "Java heap space" [message #876841 is a reply to message #876838] Fri, 25 May 2012 11:18 Go to previous messageGo to next message
Yevgeny Shifrin is currently offline Yevgeny ShifrinFriend
Messages: 207
Registered: July 2009
Senior Member
@Axel:You forgot to add a link to similar bug report.
Re: Eclipse-CDT startup error "Java heap space" [message #876861 is a reply to message #876787] Fri, 25 May 2012 12:06 Go to previous messageGo to next message
Andrea is currently offline AndreaFriend
Messages: 27
Registered: July 2009
Junior Member
Apologies, didn't pay enough attention.

Could it be a problem with something else? Something like

http://www.karlrunge.com/x11vnc/faq.html#faq-solshm


On 05/25/2012 11:28 AM, Nicholas Lee wrote:
> Thanks, but like I said in my original post "I have tried increasing the
> Java Heap space, but this did not help."
>
> You will note that the default values for eclipse are..
> -Xms40m
> -Xmx512m
>
> and that my eclipse.ini has already increased them to...
>
> -Xms512m
> -Xmx1024m
>
> I can even give it 2GB or even 4GB and it doesn't help; and it shouldn't
> need anything like those numbers just to start Eclipse CDT.
>
> If eclipse is trying to do something like allocate a 2's complement
> negative amount of memory (e.g. "-1" = (2^31)-1 = 2147483647 bytes) of
> memory due to some clipboard string length miscalculation, then no
> amount of increasing the Java heap space is going to fix that.
> Indeed, this is the symptom that we observe. Eclipse fails OOM
> immediately upon startup and no extra amount of adding Java heap space
> helps.
>
Re: Eclipse-CDT startup error "Java heap space" [message #878053 is a reply to message #876861] Mon, 28 May 2012 12:27 Go to previous messageGo to next message
Nicholas Lee is currently offline Nicholas LeeFriend
Messages: 5
Registered: May 2012
Junior Member
It may be due to something else, but it is Eclipse CDT that reports the error message, not x11vnc.

In the problem described at the link you gave (I.e. Q-71), x11vnc itself fails with an error message, and I am not seeing that happen.
Re: Eclipse-CDT startup error "Java heap space" [message #878366 is a reply to message #876841] Tue, 29 May 2012 06:48 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
Yevgeny Shifrin wrote on Fri, 25 May 2012 13:18
@Axel:You forgot to add a link to similar bug report.

Ups. Here it is http://ubuntuforums.org/archive/index.php/t-1422740.html


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Eclipse-CDT startup error "Java heap space" [message #880960 is a reply to message #878053] Sun, 03 June 2012 13:45 Go to previous messageGo to next message
Andrea is currently offline AndreaFriend
Messages: 27
Registered: July 2009
Junior Member
On 05/28/2012 02:27 PM, Nicholas Lee wrote:
> It may be due to something else, but it is Eclipse CDT that reports the
> error message, not x11vnc.
>
> In the problem described at the link you gave (I.e. Q-71), x11vnc itself
> fails with an error message, and I am not seeing that happen.

True that. On the other side:

1) it mentions shared memory. If I understand correctly x11vnc and
Eclipse run on the same machine, so if Eclipse uses shared memory (which
might be the case with copy and paste) it could be a problem. Also, the
way that question starts "I have lots of memory", got me thinking. And
it's strange how Eclipse is giving memory problems exactly in the moment
you use x11vnc.
I have never tried it, but maybe you can monitor your memory, shared and
not, using one of the /proc files. Look here:

http://linux.die.net/man/5/proc

/proc/meminfo seems to be quite interesting. And in /proc you can also
change the amount of shared memory slots

2) if the problem is not with Eclipse it might be worth looking
somewhere else. If there is another option to consider I would consider
it, no matter where the error comes from.
Re: Eclipse-CDT startup error "Java heap space" [message #897225 is a reply to message #876787] Mon, 23 July 2012 09:35 Go to previous messageGo to next message
D.priyanka yadav is currently offline D.priyanka yadavFriend
Messages: 1
Registered: July 2012
Junior Member
hello sir

I just started using h2 database

and my task is to insert 1 million records in h2 database connected with eclipse and it got connected also..and max 10,000 records it is inserting...when i ask for all records it is giving..java heap space exception

Then i increased the heap size in eclipse using this command
-Xms512m
-Xmx1090m
-XX:+UseParallelGC
-XX:PermSize=256M
-XX:MaxPermSize=512M


Than also no change

and if i increase -Xmx 2g or 3g it is giving exception as cannot connect to java virtual machine error


iam using windows 7 operating system,64 bit,8gb memory

so I'm sure this should support for connecting..

so.how to increase memory size, and what time it takes to insert 1 million record is my task...

so please help me...as soon as possible...
Re: Eclipse-CDT startup error "Java heap space" [message #990900 is a reply to message #872041] Fri, 14 December 2012 18:11 Go to previous message
Vinicius Missing name is currently offline Vinicius Missing nameFriend
Messages: 1
Registered: December 2012
Junior Member

Just to add some info, I was having this problem today and I am not using VNC. I saw the message about clipboard issues and tried clearing my clipboard (just copied a single letter from a text) and the problem vanished. This was happening with both Indigo and Juno.
Previous Topic:function stub template
Next Topic:Debugging complex application startup.
Goto Forum:
  


Current Time: Sun Dec 21 12:12:48 GMT 2014

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

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