Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.getEObjectToIDMap() as WeakHashMap
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.getEObjectToIDMap() as WeakHashMap [message #1765562] Mon, 12 June 2017 13:19 Go to next message
Andreas Graf is currently offline Andreas GrafFriend
Messages: 207
Registered: July 2009
Senior Member
Hi all,

org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.getEObjectToIDMap()

uses a HashMap per default. Wouldn't it make sense to change this into a WeakHashMap, otherwise this might prevent elements that are deleted from the resource being garbage collected?

Similar with org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.getIDToEObjectMap(), but here it would be more difficult to use a WeakReferenceValue without breaking stuff?

Regards,

Andreas
Re: org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.getEObjectToIDMap() as WeakHashMap [message #1765565 is a reply to message #1765562] Mon, 12 June 2017 13:39 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6040
Registered: July 2009
Senior Member
Hi

Please no. An extra Object for every EObject just to help users who cannot manage unloading? Could increase memory usage by perhaps 20%. If users can enable IDs they can clean up too.

Regards

Ed Willink
Re: org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.getEObjectToIDMap() as WeakHashMap [message #1765583 is a reply to message #1765565] Mon, 12 June 2017 15:03 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 29545
Registered: July 2009
Senior Member
Unloading a resource, removing objects from the resource, or removing objects from the containment tree of the resource should (normally) remove the objects from the maps, so there should be no reason to make them weak.
Re: org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.getEObjectToIDMap() as WeakHashMap [message #1765591 is a reply to message #1765583] Mon, 12 June 2017 15:26 Go to previous messageGo to next message
Andreas Graf is currently offline Andreas GrafFriend
Messages: 207
Registered: July 2009
Senior Member
Hi Ed,

which code would handle removing ids when objects are being removed from the resource? It does not seem to happen in our case and we would like to debug :)

Thanks,

Andreas
Re: org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.getEObjectToIDMap() as WeakHashMap [message #1765592 is a reply to message #1765591] Mon, 12 June 2017 15:29 Go to previous messageGo to next message
Andreas Graf is currently offline Andreas GrafFriend
Messages: 207
Registered: July 2009
Senior Member
org.eclipse.emf.ecore.resource.impl.ResourceImpl.detachedHelper(EObject), is it?
Re: org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.getEObjectToIDMap() as WeakHashMap [message #1765614 is a reply to message #1765592] Mon, 12 June 2017 19:37 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 29545
Registered: July 2009
Senior Member
Yes.
Previous Topic:[CDO] XML repository import for Mysql
Next Topic:Delcare imports when generating operation body [SOLVED]
Goto Forum:
  


Current Time: Sat Sep 22 00:57:41 GMT 2018

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

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

Back to the top