Home » Modeling » EMF » OOM, ResourceSet, unload(), reloads (Xtext), IReferableElementsUnloader..
OOM, ResourceSet, unload(), reloads (Xtext), IReferableElementsUnloader.. [message #1234979] |
Thu, 23 January 2014 09:17 |
Michael Vorburger Messages: 103 Registered: July 2009 |
Senior Member |
|
|
Hello,
couple of questions re. memory usage; not theoretical, but based on big problems with OOMs in in-house product... BTW, we're Xtext users, but I think these Qs are generic:
First of all: Is my basic understanding correct that in EMF, out of the box, a given ResourceSet just keeps growing, until you eventually OOM (if you have loads of models), unless you manually unload() Resources?
So, in a "bulk" use case, say Validating or Code Generating say 1000x (Xtext) Resources, you just.. iterate over your stuff, getResource(uri, true) from "the" ResourceSet, do your.. thing, and then simply unload() it again? (Or would you delete() it??)
But, in Xtext, during typical Code Gen or Validation, when you follow an EReference to EObjects, often others Resources will get loaded on demand (via the Index and all that fantastic magic). When you unload that primary resource you just validated / generated, as above, will those secondary on-demand loaded Resources also get unloaded? If not, then when will they get unloaded, by who?
And isn't this very inefficient.. suppose a model with a resource B which references to stuff in resource A (not the other way around, suppose). You you bulk code gen/validate "in order", so first A loaded... do your thing.. unload - it's gone from the ResourceSet. Now B... loading it... some validation/code gen code traveres an EReference into A.. now loading A -- again; we just we had it in mem before!- Done, unloading B. Uops, A is still in the RS.
Now, I do understand that I'm essentially asking to "have cake and eat it too" (first expecting a Resource to stick around in the RS, and the complaining that it has..), but - wouldn't it be feasible to, somehow, build some.. thing (e.g. ResourceSet wrapper?) for a kind of automagic Resource unload strategy? Say on reaching a max number of entries in the ResourceSet, or when GC needs heap, if the Resources are not referenced anywhere else (WeakReference..), do unload(). Are there any other projects I should be aware of which have successfully done this before on top of EMF? Or is this a completely stupid idea? Would further public investigations around this be of general interest to others?
BTW: What exactly is the org.eclipse.xtext.parser.antlr.IReferableElementsUnloader thing, what's it's point, why needed, how are you supposed to use it, and does it relate to the above at all? (There doesn't seem to be any documentation about this, anywhere I looked at least.)
Sorry, too many Qs.. do enlighten me! Maybe I'm just totally not getting how this is supposed to work / be used. Thanks a lot.
|
|
|
Re: OOM, ResourceSet, unload(), reloads (Xtext), IReferableElementsUnloader.. [message #1234999 is a reply to message #1234979] |
Thu, 23 January 2014 10:03 |
Felix Dorner Messages: 295 Registered: March 2012 |
Senior Member |
|
|
On 23/01/2014 10:17, Michael Vorburger wrote:
> First of all: Is my basic understanding correct that in EMF, out of the
> box, a given ResourceSet just keeps growing, until you eventually OOM
> (if you have loads of models), unless you manually unload() Resources?
Even unloading might increase heap usage, see Eikes blog post:
http://thegordian.blogspot.it/2008/11/how-scalable-are-my-models.html
|
|
| | |
Goto Forum:
Current Time: Thu Apr 18 00:34:05 GMT 2024
Powered by FUDForum. Page generated in 0.02004 seconds
|