Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 355328

Summary: [otre] class RepositoryAccess is wasting memory
Product: [Tools] Objectteams Reporter: Stephan Herrmann <stephan.herrmann>
Component: OTJAssignee: Stephan Herrmann <stephan.herrmann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0   
Target Milestone: 2.1 M2   
Hardware: Other   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Implementation of diet class loading none

Description Stephan Herrmann CLA 2011-08-21 18:29:57 EDT
In a heap dump of an OTDT that has been working for quite some time
I can see that almost 50% of the memory are consumed by class
org.eclipse.objectteams.otre.RepositoryAccess via static field
repositories. This hashmap keeps instances of JavaClass for further
lookup, but most clients of this lookup are only interested in
superclass/ifc linkage.

Only one location uses the JavaClass for searching a method signature.
This is during ObjectTeamsTransformation.addTeamInitializations() 
while evaluating a team-config for standalone OT/J app.

It should be possible to store this information in a much more compact
form.
Comment 1 Stephan Herrmann CLA 2011-08-23 08:44:22 EDT
Created attachment 201992 [details]
Implementation of diet class loading

This patch implements diet versions of ClassLoaderRepository,
ClassParser and JavaClass, which only read structural information
and dispose the constant pool after reading.

Only one client needs to lookup a method signature:
ObjectTeamsTransformation.addTeamInitializations(),
which is now handled by a new method lookupClassFully().

When running the OTDT (SDK based install) with OT perspective and a
team class open, I could observe (using MAT) the following improvement:

Old: class RepositoryAccess retains 239 MBytes on the heap!
New: class RepositoryAccess retains 2.3 MBytes on the heap!
Comment 2 Stephan Herrmann CLA 2011-08-23 08:48:48 EDT
Patch has been released for 2.1 M2 (r1959).
Comment 3 Stephan Herrmann CLA 2013-02-20 15:14:37 EST
Verified: using 2.2 M5 RepositoryAccess is no longer relevant in terms of retained memory.