Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » OutOfMemoryError: Java heap space
OutOfMemoryError: Java heap space [message #663361] Mon, 04 April 2011 19:10 Go to next message
Rafael Angarita is currently offline Rafael AngaritaFriend
Messages: 94
Registered: November 2010
Member
Hello guys,

I'm still struggling with the problem of how to handle very large projects. Right now, my test project has almost 15000 files. Fortunately, this is the bigger of the project I will have to import using my DSL.

At first, I couldn't run my xtext project alone with all the files. After enabling the clustering Xtext Builder that Sebastian explains here, everything worked great.

Now, I'm trying to do the full build enabling my implementation of IXtextBuilderParticipant, which is in another plugin.

The first round of the build goes ok, but in the second round I start getting the references, and eclipse and my machine start to slow down, until I get:

java.lang.OutOfMemoryError: Java heap space
	at java.lang.String.toLowerCase(String.java:2485)
	at java.lang.String.toLowerCase(String.java:2508)
	at org.eclipse.xtext.resource.impl.EObjectDescriptionLookUp.getExportedObjects(EObjectDescriptionLookUp.java:42)
	at org.eclipse.xtext.resource.impl.AbstractResourceDescription.getExportedObjects(AbstractResourceDescription.java:27)
	at org.eclipse.xtext.resource.impl.AbstractContainer$2.apply(AbstractContainer.java:41)
	at org.eclipse.xtext.resource.impl.AbstractContainer$2.apply(AbstractContainer.java:1)
	at com.google.common.collect.Iterators$10.next(Iterators.java:662)
	at com.google.common.collect.Iterators$10.next(Iterators.java:661)
	at com.google.common.collect.Iterators$6.hasNext(Iterators.java:477)
	at org.eclipse.xtext.scoping.impl.ContainerBasedScope.getContentByName(ContainerBasedScope.java:46)
	at org.eclipse.xtext.linking.impl.ImportedNamesAdapter$WrappingScope.getContentByName(ImportedNamesAdapter.java:52)
	at org.eclipse.xtext.linking.impl.DefaultLinkingService.getLinkedObjects(DefaultLinkingService.java:106)
	at org.eclipse.xtext.linking.lazy.LazyLinkingResource.getEObject(LazyLinkingResource.java:94)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getEObject(ResourceSetImpl.java:219)
	at org.eclipse.emf.ecore.util.EcoreUtil.resolve(EcoreUtil.java:202)
	at org.eclipse.emf.ecore.util.EcoreUtil.resolve(EcoreUtil.java:262)
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eResolveProxy(BasicEObjectImpl.java:1483)
	at org.xtext.altagracia.attribute.impl.AttributeImpl.getDomain(AttributeImpl.java:258)
	at altagracia.plugin.wizards.Connect.addAttributeReferences(Connect.java:130)
	at altagracia.plugin.wizards.Connect.addAttributeReferences(Connect.java:122)
	at altagracia.plugin.wizards.Connect.updateReferences(Connect.java:69)
	at altagracia.plugin.wizards.Connect.fileReference(Connect.java:364)
	at altagracia.builder.xTextAltagraciaBuilderLogic.SecondFullBuildFile(xTextAltagraciaBuilderLogic.java:100)
	at altagracia.builder.XtextAltagraciaBuilderParticipant.build(XtextAltagraciaBuilderParticipant.java:111)
	at org.eclipse.xtext.builder.impl.RegistryBuilderParticipant.build(RegistryBuilderParticipant.java:60)
	at org.eclipse.xtext.builder.impl.XtextBuilder.doBuild(XtextBuilder.java:157)
	at org.eclipse.xtext.builder.impl.XtextBuilder.fullBuild(XtextBuilder.java:180)
	at org.eclipse.xtext.builder.impl.XtextBuilder.build(XtextBuilder.java:78)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:629)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:172)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:203)



This line:

at altagracia.plugin.wizards.Connect.addAttributeReferences(Connect.java:130)


is:

attribute.getDomain()


Attribute and Domain are two of my garmmars, and a Attribute can cross-reference a Domain.

I don't know if there is something wrong with my IXtextBuilderParticipant or there is something else going on. I know it can be difficult for you guys to know what's happening here. I'm looking for maybe an advise of how to handle this big projects, a suggestion. If you want to look deeper, I don't have any problem if you want me to share my code with you.

Thank you very much!





Re: OutOfMemoryError: Java heap space [message #663371 is a reply to message #663361] Mon, 04 April 2011 19:26 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Rafael,

you'll have to make sure that you do not load the whole world into one
single resource set with your builder participant, e.g. by applying
clustering strategies there, too.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 04.04.11 21:10, schrieb Rafael Angarita:
> Hello guys,
> I'm still struggling with the problem of how to handle very large
> projects. Right now, my test project has almost 15000 files.
> Fortunately, this is the bigger of the project I will have to import
> using my DSL.
>
> At first, I couldn't run my xtext project alone with all the files.
> After enabling the clustering Xtext Builder that Sebastian explains
> here, everything worked great.
>
> Now, I'm trying to do the full build enabling my implementation of
> IXtextBuilderParticipant, which is in another plugin.
>
> The first round of the build goes ok, but in the second round I start
> getting the references, and eclipse and my machine start to slow down,
> until I get:
>
>
> java.lang.OutOfMemoryError: Java heap space
> at java.lang.String.toLowerCase(String.java:2485)
> at java.lang.String.toLowerCase(String.java:2508)
> at
> org.eclipse.xtext.resource.impl.EObjectDescriptionLookUp.get ExportedObjects(EObjectDescriptionLookUp.java:42)
>
> at
> org.eclipse.xtext.resource.impl.AbstractResourceDescription. getExportedObjects(AbstractResourceDescription.java:27)
>
> at
> org.eclipse.xtext.resource.impl.AbstractContainer$2.apply(Ab stractContainer.java:41)
>
> at
> org.eclipse.xtext.resource.impl.AbstractContainer$2.apply(Ab stractContainer.java:1)
>
> at com.google.common.collect.Iterators$10.next(Iterators.java:6 62)
> at com.google.common.collect.Iterators$10.next(Iterators.java:6 61)
> at com.google.common.collect.Iterators$6.hasNext(Iterators.java :477)
> at
> org.eclipse.xtext.scoping.impl.ContainerBasedScope.getConten tByName(ContainerBasedScope.java:46)
>
> at
> org.eclipse.xtext.linking.impl.ImportedNamesAdapter$Wrapping Scope.getContentByName(ImportedNamesAdapter.java:52)
>
> at
> org.eclipse.xtext.linking.impl.DefaultLinkingService.getLink edObjects(DefaultLinkingService.java:106)
>
> at
> org.eclipse.xtext.linking.lazy.LazyLinkingResource.getEObjec t(LazyLinkingResource.java:94)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getEObje ct(ResourceSetImpl.java:219)
>
> at org.eclipse.emf.ecore.util.EcoreUtil.resolve(EcoreUtil.java: 202)
> at org.eclipse.emf.ecore.util.EcoreUtil.resolve(EcoreUtil.java: 262)
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eResolveProxy(Ba sicEObjectImpl.java:1483)
>
> at
> org.xtext.altagracia.attribute.impl.AttributeImpl.getDomain( AttributeImpl.java:258)
>
> at
> altagracia.plugin.wizards.Connect.addAttributeReferences(Con nect.java:130)
> at
> altagracia.plugin.wizards.Connect.addAttributeReferences(Con nect.java:122)
> at altagracia.plugin.wizards.Connect.updateReferences(Connect.j ava:69)
> at altagracia.plugin.wizards.Connect.fileReference(Connect.java :364)
> at
> altagracia.builder.xTextAltagraciaBuilderLogic.SecondFullBui ldFile(xTextAltagraciaBuilderLogic.java:100)
>
> at
> altagracia.builder.XtextAltagraciaBuilderParticipant.build(X textAltagraciaBuilderParticipant.java:111)
>
> at
> org.eclipse.xtext.builder.impl.RegistryBuilderParticipant.bu ild(RegistryBuilderParticipant.java:60)
>
> at
> org.eclipse.xtext.builder.impl.XtextBuilder.doBuild(XtextBui lder.java:157)
> at
> org.eclipse.xtext.builder.impl.XtextBuilder.fullBuild(XtextB uilder.java:180)
>
> at org.eclipse.xtext.builder.impl.XtextBuilder.build(XtextBuild er.java:78)
> at
> org.eclipse.core.internal.events.BuildManager$2.run(BuildMan ager.java:629)
> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
> at
> org.eclipse.core.internal.events.BuildManager.basicBuild(Bui ldManager.java:172)
>
> at
> org.eclipse.core.internal.events.BuildManager.basicBuild(Bui ldManager.java:203)
>
>
>
>
> This line:
>
>
> at
> altagracia.plugin.wizards.Connect.addAttributeReferences(Con nect.java:130)
>
>
> is:
>
>
> attribute.getDomain()
>
>
> Attribute and Domain are two of my garmmars, and a Attribute can
> cross-reference a Domain.
>
> I don't know if there is something wrong with my
> IXtextBuilderParticipant or there is something else going on. I know it
> can be difficult for you guys to know what's happening here. I'm looking
> for maybe an advise of how to handle this big projects, a suggestion. If
> you want to look deeper, I don't have any problem if you want me to
> share my code with you.
>
> Thank you very much!
>
>
>
>
>
>
Re: OutOfMemoryError: Java heap space [message #663372 is a reply to message #663361] Mon, 04 April 2011 19:36 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

have you checked, that you really only export objects that should be referrable from outside a file? (Even if an object has a name feature, you may not need it to be visible globally.)
Have you considered implementing a fragment provider that comes up with more concise URIs for the exported objects (very useful, if exported objects are nested deeply)?
Both may reduce the memory footprint considerably.

Alex
Re: OutOfMemoryError: Java heap space [message #663378 is a reply to message #663372] Mon, 04 April 2011 19:53 Go to previous messageGo to next message
Rafael Angarita is currently offline Rafael AngaritaFriend
Messages: 94
Registered: November 2010
Member
Thank you very much Sebastian and Alexander for your answers.

Sebastian, I have really no idea about how to implement clustering strategies or anything else like that in my builder implementation.

Alexander, I will look into that.

Thank you very much for your help!
Re: OutOfMemoryError: Java heap space [message #663528 is a reply to message #663378] Tue, 05 April 2011 13:57 Go to previous messageGo to next message
Rafael Angarita is currently offline Rafael AngaritaFriend
Messages: 94
Registered: November 2010
Member
Hi,

I have this grammar:

TableDefinition:
	table=Table;
	
Table:
	'Name:' name=ID
	'Columns:' '{' columns+=Column (',' columns+=Column)* '}'
	'Indexes:' '{' indexes+=Index+ '}'
;

Column:
	attribute=[attributeAG::Attribute] 
;

Index: {Index}
	'Index:'   name=IndexName
	'Columns:'  '{' indexcolumns+=IndexColumn (',' indexcolumns+=IndexColumn)* '}'
;

IndexName:
	ID
;

IndexColumn:
	indexColumn=[Column]
;



As you see, I have to give a QN to a Column of the Table to make them referencable inside its current Table as an Index. I don't want to make those coulmns visible from outside.

I have hundreds of tables, which one with more than 10 attributes (columns) and I guess those more than 10 attributes per table are being exported to the global scope generating a heavy memory consumption I do not need. Am I right?


If I am right I would like to not export them to the global scope, but I haven't figure it out yet. I have been looking here: http:// www.eclipse.org/Xtext/documentation/1_0_0/xtext.html#resourc edescriptions but it's not clear to me how should I implement it.

I thought I should override a method like bindIResourceDescription in my TableRuntimeModel to register my implementation class, but I think I was wrong.

How should I do this?

Thank you very much for your help!







Re: OutOfMemoryError: Java heap space [message #663709 is a reply to message #663528] Wed, 06 April 2011 09:23 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
Rafael,

to decide yourself what is indexed you must implement and bind an
IResourceDescription.Manager.

Regards
Jan

Am 05.04.11 15:57, schrieb Rafael Angarita:
> Hi,
> I have this grammar:
>
>
> TableDefinition:
> table=Table;
>
> Table:
> 'Name:' name=ID
> 'Columns:' '{' columns+=Column (',' columns+=Column)* '}'
> 'Indexes:' '{' indexes+=Index+ '}'
> ;
>
> Column:
> attribute=[attributeAG::Attribute] ;
>
> Index: {Index}
> 'Index:' name=IndexName
> 'Columns:' '{' indexcolumns+=IndexColumn (','
> indexcolumns+=IndexColumn)* '}'
> ;
>
> IndexName:
> ID
> ;
>
> IndexColumn:
> indexColumn=[Column]
> ;
>
>
>
> As you see, I have to give a QN to a Column of the Table to make them
> referencable inside its current Table as an Index. I don't want to make
> those coulmns visible from outside.
> I have hundreds of tables, which one with more than 10 attributes
> (columns) and I guess those more than 10 attributes per table are being
> exported to the global scope generating a heavy memory consumption I do
> not need. Am I right?
>
>
> If I am right I would like to not export them to the global scope, but I
> haven't figure it out yet. I have been looking here:
> http://www.eclipse.org/Xtext/documentation/1_0_0/xtext.html# resourcedescriptions
> but it's not clear to me how should I implement it.
>
> I thought I should override a method like bindIResourceDescription in my
> TableRuntimeModel to register my implementation class, but I think I was
> wrong.
>
> How should I do this?
>
> Thank you very much for your help!
>
>
>
>
>
>
>
>


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com


---
Get professional support from the Xtext committers at www.typefox.io
Re: OutOfMemoryError: Java heap space [message #663779 is a reply to message #663709] Wed, 06 April 2011 13:31 Go to previous messageGo to next message
Rafael Angarita is currently offline Rafael AngaritaFriend
Messages: 94
Registered: November 2010
Member
Hi Jan, thank you for your answer.

I bound my implementation in the TableRuntimeModule:

public Class<? extends IResourceDescription.Manager> bindIResourceDescriptionManager() {
		return MyResourceDescriptionManager.class;
	}



My implementation only contains the code showed in the documentation:

@Inject
	private IResourceServiceProvider.Registry resourceServiceProviderRegistry;

	private IResourceDescription.Manager getManager(Resource res) {
		IResourceServiceProvider resourceServiceProvider = 
		resourceServiceProviderRegistry.getResourceServiceProvider(res.getURI());
		return resourceServiceProvider.getResourceDescriptionManager();
	}

	
	
	@Override
	public IResourceDescription getResourceDescription(Resource resource) {
		//System.out.println("resource");
		Manager manager = getManager(resource);
		IResourceDescription description = manager.getResourceDescription(resource);
		for(IEObjectDescription objDescription : description.getExportedObjects()) {
			System.out.println(objDescription.getQualifiedName());
		}
		
		return null;
	}


, but it seems to be called always with the same resource, until it throws stackoverflowerror at this line:

IResourceDescription description = manager.getResourceDescription(resource);


Any ideas?

Thank you very much guys for your help!





Re: OutOfMemoryError: Java heap space [message #663888 is a reply to message #663779] Wed, 06 April 2011 17:41 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

you implemented and bound a manager. In the getResourceDescription method you now ask for the manager for that resource and call its getResourceDescription method.
"You" are the manager for that resource... the method basically calls itself (a bit of debugging would have revealed that).

What you can do is either let default implementation calculate all exported objects and then filter that list or copy and adapt the relevant code to calculate only those IEObjectDescriptions that really should be exported.

Alex
Re: OutOfMemoryError: Java heap space [message #667191 is a reply to message #663361] Wed, 27 April 2011 09:53 Go to previous messageGo to next message
Arthur is currently offline ArthurFriend
Messages: 11
Registered: June 2010
Junior Member
Actually, I have the same problem with M6.

* I've created a new project with the "greeting" sample untouched.
* Uncommented the project generator in the mwe2 file and ran it.
* Launched a new Eclipse Application in debug mode
* Created a new project using the generated project wizard from above.

Now the application locks up and i get the following in the hosting eclipse's console:
Error while logging event loop exception:
java.lang.OutOfMemoryError: PermGen space
java.lang.OutOfMemoryError: PermGen space

I've not found a fix for it or tried a nightly build yet though.
Re: OutOfMemoryError: Java heap space [message #667232 is a reply to message #667191] Wed, 27 April 2011 14:45 Go to previous messageGo to next message
Arthur is currently offline ArthurFriend
Messages: 11
Registered: June 2010
Junior Member
Using a nightly build installed just now and according to the instructions at http://www.techjava.de/topics/2011/04/xtext-2-0-milestone-in stallation/ I still get the same error.

I used Helios SR2 and http://www.eclipse.org/modeling/download.php?file=/modeling/ tmf/xtext/downloads/drops/2.0.0/N201104260904/tmf-xtext-Upda te-N201104260904.zip.
Re: OutOfMemoryError: Java heap space [message #667260 is a reply to message #667232] Wed, 27 April 2011 16:55 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Arthur,

did you try to increase the size of the PermGenSpace?
Adding -XX:MaxPermSize=128m should do the trick.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 27.04.11 16:45, schrieb Arthur:
> Using a nightly build installed just now and according to the
> instructions at
> http://www.techjava.de/topics/2011/04/xtext-2-0-milestone-in stallation/
> I still get the same error.
>
> I used Helios SR2 and
> http://www.eclipse.org/modeling/download.php?file=/modeling/ tmf/xtext/downloads/drops/2.0.0/N201104260904/tmf-xtext-Upda te-N201104260904.zip
>
Re: OutOfMemoryError: Java heap space [message #667456 is a reply to message #667260] Thu, 28 April 2011 20:21 Go to previous message
Arthur is currently offline ArthurFriend
Messages: 11
Registered: June 2010
Junior Member
Yup, that worked fine! Thanks!

Just out of curiosity, how is the parameter set with the eclipse product? Will it be set somehow when Indigo is released?
Previous Topic:[xbase] mimic purexbase with interpreter (instead of compiler).
Next Topic:Problem: XPand & JavaVMTypes
Goto Forum:
  


Current Time: Fri Apr 19 23:02:34 GMT 2024

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

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

Back to the top