Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » why during my unload crossreferencer resolve my already unloaded resources .... ?
why during my unload crossreferencer resolve my already unloaded resources .... ? [message #645415] Fri, 17 December 2010 08:07 Go to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
Hi UML2 and EMF.
I have a resourceset with UML2 resources and own resources linked to my
UML resources.
I do the "typical" unload at the end of my process to empty my resource
set and empty the UML2 CacheAdapter (in fact the InverseCrossReferencer
of the cache adapter).

for (Iterator<Resource> i = set.getResources().iterator() ; i.hasNext() ; )
{
Resource r = i.next() ;
r.unload();
i.remove();
}

The problem is when I unload a resource I can notice this stack trace
org.topcased.modeler.diagrams.model.util.DiagramsResourceImp l(org.eclipse.emf.ecore.resource.impl.ResourceImpl).load(jav a.io.InputStream,
java.util.Map<?,?>) line: 1514
org.topcased.modeler.diagrams.model.util.DiagramsResourceImp l(org.eclipse.emf.ecore.resource.impl.ResourceImpl).load(jav a.util.Map <?,?>)
line: 1282
org.topcased.modeler.editor.TopcasedAdapterFactoryEditingDom ain$TopcasedAdapterFactoryEditingDomainResourceSet(org.eclip se.emf.ecore.resource.impl.ResourceSetImpl).demandLoad(org.e clipse.emf.ecore.resource.Resource)
line: 255
org.topcased.modeler.editor.TopcasedAdapterFactoryEditingDom ain$TopcasedAdapterFactoryEditingDomainResourceSet(org.eclip se.emf.ecore.resource.impl.ResourceSetImpl).demandLoadHelper (org.eclipse.emf.ecore.resource.Resource)
line: 270
org.topcased.modeler.editor.TopcasedAdapterFactoryEditingDom ain$TopcasedAdapterFactoryEditingDomainResourceSet(org.eclip se.emf.ecore.resource.impl.ResourceSetImpl).getResource(org. eclipse.emf.common.util.URI,
boolean) line: 397
org.topcased.modeler.editor.TopcasedAdapterFactoryEditingDom ain$TopcasedAdapterFactoryEditingDomainResourceSet.getResour ce(org.eclipse.emf.common.util.URI,
boolean) line: 482
org.topcased.modeler.editor.TopcasedAdapterFactoryEditingDom ain$TopcasedAdapterFactoryEditingDomainResourceSet(org.eclip se.emf.ecore.resource.impl.ResourceSetImpl).getEObject(org.e clipse.emf.common.util.URI,
boolean) line: 216
org.eclipse.emf.ecore.util.EcoreUtil.resolve(org.eclipse.emf .ecore.EObject,
org.eclipse.emf.ecore.resource.ResourceSet) line: 202
org.eclipse.emf.ecore.util.EcoreUtil.resolve(org.eclipse.emf .ecore.EObject,
org.eclipse.emf.ecore.EObject) line: 262
org.topcased.modeler.diagrams.model.internal.impl.DiagramsIm pl(org.eclipse.emf.ecore.impl.BasicEObjectImpl).eResolveProx y(org.eclipse.emf.ecore.InternalEObject)
line: 1483
org.eclipse.emf.ecore.util.EObjectContainmentWithInverseELis t$Resolving <E>(org.eclipse.emf.ecore.util.EcoreEList<E>).resolveProxy(org.eclipse.emf.ecore.EObject)
line: 212
org.eclipse.emf.ecore.util.EObjectContainmentWithInverseELis t$Resolving <E>(org.eclipse.emf.ecore.util.EcoreEList<E>).resolve(int,
org.eclipse.emf.ecore.EObject) line: 167
org.eclipse.emf.ecore.util.EObjectContainmentWithInverseELis t$Resolving <E>.resolve(int,
E) line: 111
org.eclipse.emf.ecore.util.EObjectContainmentWithInverseELis t$Resolving <E>(org.eclipse.emf.common.util.BasicEList<E>).get(int)
line: 354
org.eclipse.emf.ecore.util.EContentsEList$ResolvingFeatureIt eratorImpl <E> (org.eclipse.emf.ecore.util.EContentsEList$FeatureIteratorIm pl <E>).hasNext()
line: 484
org.eclipse.emf.ecore.util.EContentsEList$ResolvingFeatureIt eratorImpl <E> (org.eclipse.emf.ecore.util.EContentsEList$FeatureIteratorIm pl <E>).next()
line: 565
org.topcased.modeler.diagrams.model.util.CrossReferenceAdapt er(org.eclipse.emf.ecore.util.ECrossReferenceAdapter).unsetT arget(org.eclipse.emf.ecore.EObject)
line: 780
org.topcased.modeler.diagrams.model.util.CrossReferenceAdapt er(org.eclipse.emf.ecore.util.ECrossReferenceAdapter).unsetT arget(org.eclipse.emf.common.notify.Notifier)
line: 747
org.eclipse.emf.common.notify.impl.BasicNotifierImpl$EAdapte rList <E>.didRemove(int,
E) line: 156
org.eclipse.emf.common.notify.impl.BasicNotifierImpl$EAdapte rList <E>(org.eclipse.emf.common.util.BasicEList<E>).remove(int)
line: 622
org.eclipse.emf.common.notify.impl.BasicNotifierImpl$EAdapte rList <E>.remove(int)
line: 227
org.eclipse.emf.common.notify.impl.BasicNotifierImpl$EAdapte rList <E>(org.eclipse.emf.common.util.AbstractEList<E>).remove(java.lang.Object)
line: 466
org.eclipse.emf.common.notify.impl.BasicNotifierImpl$EAdapte rList <E>.remove(java.lang.Object)
line: 220
org.topcased.modeler.diagrams.model.util.CrossReferenceAdapt er(org.eclipse.emf.ecore.util.ECrossReferenceAdapter).remove Adapter(org.eclipse.emf.common.notify.Notifier)
line: 828
org.topcased.modeler.diagrams.model.util.CrossReferenceAdapt er(org.eclipse.emf.ecore.util.ECrossReferenceAdapter).unsetT arget(org.eclipse.emf.ecore.EObject)
line: 784
org.topcased.modeler.diagrams.model.util.CrossReferenceAdapt er(org.eclipse.emf.ecore.util.ECrossReferenceAdapter).unsetT arget(org.eclipse.emf.common.notify.Notifier)
line: 747
org.eclipse.emf.common.notify.impl.BasicNotifierImpl$EAdapte rList <E>.didRemove(int,
E) line: 156
org.eclipse.emf.common.notify.impl.BasicNotifierImpl$EAdapte rList <E>(org.eclipse.emf.common.util.AbstractEList<E>).didClear(int,
java.lang.Object[]) line: 172
org.eclipse.emf.common.notify.impl.BasicNotifierImpl$EAdapte rList <E>(org.eclipse.emf.common.util.BasicEList<E>).clear()
line: 646
org.eclipse.emf.common.notify.impl.BasicNotifierImpl$EAdapte rList <E>.clear()
line: 241
org.topcased.modeler.diagrams.model.util.DiagramsResourceImp l(org.eclipse.emf.ecore.resource.impl.ResourceImpl).unloaded (org.eclipse.emf.ecore.InternalEObject)
line: 1565
org.topcased.modeler.diagrams.model.util.DiagramsResourceImp l(org.eclipse.emf.ecore.resource.impl.ResourceImpl).doUnload ()
line: 1624
org.topcased.modeler.diagrams.model.util.DiagramsResourceImp l(org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl).doUnload()
line: 506
org.topcased.modeler.diagrams.model.util.DiagramsResourceImp l(org.eclipse.emf.ecore.resource.impl.ResourceImpl).unload()
line: 1639

The problem comes from an adapter list of the resource which is cleared
and this list triggers adapter mechanisms which will resolve elements
which will load a resource unloaded which will fill again the
CacheAdapter and creates a memory leak in my application.

How can I avoid this kind of solutions? My goal is having only proxies
after my unload process and with this behavior, it never happens.




Re: why during my unload crossreferencer resolve my already unloaded resources .... ? [message #647317 is a reply to message #645415] Wed, 05 January 2011 16:21 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
Hi UML 2 !
I improve my unload mechanism clearing my adapters before unloading.

I would like to know now why after unloading (it is maybe an impact of my adapter deletion) the cache adapter and particularly the inverse cross referencer is so big ?

I have checked with MAT the content of my memory and the cache adapter contains proxy but it is a very large amount of data. Is there a way to force deletion of it ?

overriding the default adapter with vm arguments is not an option for me Sad

Regards
Tristan FAURE




Re: why during my unload crossreferencer resolve my already unloaded resources .... ? [message #647447 is a reply to message #647317] Thu, 06 January 2011 12:58 Go to previous messageGo to next message
Vlad Varnica is currently offline Vlad VarnicaFriend
Messages: 546
Registered: July 2009
Location: Milton Keynes - UK
Senior Member
I think that there is one or more loops in the code. I mean that the same methods is executed more than once.
You can not fix it because this should be done directly in the framework and you only have jar files packaging.

If you have time you can pick up the source code from SVN and then launch your application. You will be able to find out if you trace your methods where they are going. Then you desactivate few of them and look if it always works, and try again. It is very difficult to have a full view of the entire architecture therefore only small steps are possible if you don't want to rewrite the entire framework code !!
Very long and painful job this is why it has never been done completely Sad

[Updated on: Thu, 06 January 2011 13:00]

Report message to a moderator

Re: why during my unload crossreferencer resolve my already unloaded resources .... ? [message #647508 is a reply to message #647317] Thu, 06 January 2011 17:32 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
Tristan,

In general, turning an object into a proxy makes it bigger. After all,
a proxy URI is quite a substantial object. UML actually decomposes the
relations between objects so individual objects can be better garbage
collected, but if something is holding on to the unloaded objects (the
proxified objects), an unload will generally increase the footprint. I
would have hoped the cache adapter wouldn't be holding onto the proxies;
after all, unload does clear all the adapters...



Tristan FAURE wrote:
> Hi UML 2 !
> I improve my unload mechanism clearing my adapters before unloading.
>
> I would like to know now why after unloading (it is maybe an impact of
> my adapter deletion) the cache adapter and particularly the inverse
> cross referencer is so big ?
>
> I have checked with MAT the content of my memory and the cache adapter
> contains proxy but it is a very large amount of data. Is there a way
> to force deletion of it ?
>
> overriding the default adapter with vm arguments is not an option for
> me :(
>
> Regards
> Tristan FAURE


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: why during my unload crossreferencer resolve my already unloaded resources .... ? [message #647510 is a reply to message #647508] Thu, 06 January 2011 17:37 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
It seems it is not the case as the cache adapter when unload is performed, keeps the proxies reference (in inverseCrossReferencer) in its map. Or maybe i don't understand the behavior of the cache Sad



Re: why during my unload crossreferencer resolve my already unloaded resources .... ? [message #647513 is a reply to message #647510] Thu, 06 January 2011 17:50 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
Tristan,

I see what you mean. It is intentional that it keeps these so that it
can know about incoming references from yet-to-be-reloaded resources...


Tristan FAURE wrote:
> It seems it is not the case as the cache adapter when unload is
> performed, keeps the proxies reference (in inverseCrossReferencer) in
> its map. Or maybe i don't understand the behavior of the cache :(


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Code generation issue
Next Topic:Applying stereotypes to metaclass of UML meta model middleweight extension
Goto Forum:
  


Current Time: Thu Apr 18 18:44:15 GMT 2024

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

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

Back to the top