Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 358099 - SimpleAttributeResolver should reuse the valueCache
Summary: SimpleAttributeResolver should reuse the valueCache
Status: NEW
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.0.1   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-19 08:10 EDT by Benjamin Schwertfeger CLA
Modified: 2011-09-19 08:15 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Schwertfeger CLA 2011-09-19 08:10:17 EDT
The valueCache inside the SimpleAttributeResolver registers for each getValue an discardingAdapter at the given element. Two SimpleAttributeResolver listening at the same Feature registers two Adapter at the containing EObject.

If you use the SimpleAttributeResolver to resolve only one value and throw it away after this, the adaper (and also the resolver) are still inside the model and never garbage colltected. (Memory Leak)

Like the qualifiedName, which is cached in the eAdapter of the Resource, the simple attribute resolver should cache the value inside the eAdapter. Other instances can reuse it and the number of Adapters is limited. An alternative not caching SimpleAttributeResolver would also do the trick sometimes.

If nothing can be changed, there should be at least a note in the javadoc that the value is cached and a SimpleAttributeResolver should be reused as much as possible.