Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 319424 - Memory leaks with perspective switching (related to XMLModelReconciler)
Summary: Memory leaks with perspective switching (related to XMLModelReconciler)
Status: RESOLVED FIXED
Alias: None
Product: e4
Classification: Eclipse Project
Component: UI (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 1.0 RC2   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-09 14:37 EDT by Stefan Mücke CLA
Modified: 2010-07-20 13:22 EDT (History)
2 users (show)

See Also:


Attachments
Profiler screenshot: Memory retained by XMLModelReconciler (before/after) (119.26 KB, image/png)
2010-07-09 14:39 EDT, Stefan Mücke CLA
no flags Details
Profiler screenshot: Allocation stack trace for PerspectiveSwitcher (126.67 KB, image/png)
2010-07-09 14:40 EDT, Stefan Mücke CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Mücke CLA 2010-07-09 14:37:34 EDT
Here's what I did:

1. Open a fresh e4 workbench
2. Open the Debug perspective
3. Take a memory snapshot
4. Switch between the Java and Debug perspectives 50 times
5. Take another memory snapshot
6. Compare the memory snapshots

Switching the perspectives 50 times increased the heap size by about 2 MB, which is a leak.

1 MB of this is retained by the XMLModelReconciler. The XMLModelReconciler uses a ChangeRecorder to keep track of changes in the model. This ChangeRecorder retains a great number of model objects; these model objects are rooted at the ChangeRecorder, which means that they are no longer alive.

Another (very small) leak is that after switching the perspectives (50+10 times), there were 62 PerspectiveSwitcher instances (originally there was only one). See screenshot for allocation stack trace.

There are some more leaks related to perspective switching (the other 1 MB of the above 2 MB). There are leaked TrackableComputationExt instances. These trackables use WeakReferences, so perhaps the leak will disappear when the other leaks are fixed.
Comment 1 Stefan Mücke CLA 2010-07-09 14:39:26 EDT
Created attachment 173892 [details]
Profiler screenshot: Memory retained by XMLModelReconciler (before/after)
Comment 2 Stefan Mücke CLA 2010-07-09 14:40:31 EDT
Created attachment 173894 [details]
Profiler screenshot: Allocation stack trace for PerspectiveSwitcher
Comment 3 Remy Suen CLA 2010-07-14 08:06:03 EDT
(In reply to comment #0)
> Another (very small) leak is that after switching the perspectives (50+10
> times), there were 62 PerspectiveSwitcher instances (originally there was only
> one). See screenshot for allocation stack trace.

I don't think this should be a problem anymore as Paul has fixed my trim code to not regenerate new instances.
Comment 4 Stefan Mücke CLA 2010-07-14 08:09:34 EDT
Okay, I will verify this.
Comment 5 Stefan Mücke CLA 2010-07-14 11:30:03 EDT
Verified in CVS Head. Marking as fixed.