Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 371047 - Memory leak: deleted model elements stay in memory forever
Summary: Memory leak: deleted model elements stay in memory forever
Status: RESOLVED FIXED
Alias: None
Product: EMFStore
Classification: Modeling
Component: Common (show other bugs)
Version: unspecified   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: backlog   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-09 04:25 EST by Dmitry Litvinov CLA
Modified: 2012-10-17 09:31 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Litvinov CLA 2012-02-09 04:25:07 EST
Model elements after deletion are put into fields deletedEObjectToIdMap and newEObjectToIdMap of class IdEObjectCollectionImpl and are not removed from there anymore. This means that thay stay in memory till the project itself is closed and garbage collected.

- Model elements should be removed from deletedEObjectToIdMap, when they are not needed anymore (maybe after commit or save).
- Model elements should not be put to newEObjectToIdMap after deletetion, since they are already available in deletedEObjectToIdMap and can be received with a request to this map. This would save memory and would not affect performance significantly.
Comment 1 Edgar Mueller CLA 2012-04-17 08:02:07 EDT
Well, after looking over the code once again, I've noticed that deletedEObjectToIdMap and newEObjectToIdMap semantically do the same.  I've therefore removed deletedEObjectToIdMap completely.

Regarding clearing the elements from the newEObjectToIdMap upon commit or save: this absolutely make sense, but we need to consider the undo mechanism when talking about clearing the caches, because the latter uses the newEObjectToIdMap to retrieve elements that may have possibly deleted.  

We'll need to check where to best clear the caches and when.
Comment 2 Maximilian Koegel CLA 2012-10-17 09:31:39 EDT
caches are cleared on command completion