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

Bug 318798

Summary: e4 is leaking memory on part activation/deactivation
Product: z_Archived Reporter: Stefan Mücke <s.muecke>
Component: E4Assignee: Project Inbox <e4.runtime-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: bokowski, gheorghe, ob1.eclipse, pwebster, remy.suen
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Memory profiler screenshot with a before/after comparison
none
patch
none
Memory profiler screenshot for leaked HashMaps
none
Memory profiler screenshot for leaked HashMaps (allocation stack trace) none

Description Stefan Mücke CLA 2010-07-03 16:52:46 EDT
Build Identifier: 

e4 is leaking memory on part activation/deactivation

Reproducible: Always
Comment 1 Stefan Mücke CLA 2010-07-03 17:00:41 EDT
Created attachment 173359 [details]
Memory profiler screenshot with a before/after comparison

Here's a first analysis. Perhaps this already helps.
Comment 2 Boris Bokowski CLA 2010-07-03 17:35:03 EDT
Created attachment 173361 [details]
patch

Not sure if this accounts for all leaks - can you test again?
Comment 3 Boris Bokowski CLA 2010-07-03 17:43:26 EDT
Bogdan, the code in CSSPropertyTabRendererSWTHandler doesn't look right - you are using a single IEclipseContext for all tab folder renderers. At the very least, this probably means that all renderers share attributes like outer-keyline-color, inner-keyline-color, etc.
Comment 4 Stefan Mücke CLA 2010-07-03 17:54:38 EDT
After the patch, the leaked requestor objects and the TrackableComputationExt-related objects are gone. But, there are still the leaked HashMaps.

I will check this with the profiler's "generation count" feature and will find out where these objects are allocated. However, this is the first time I am using this feature, so that it will take some time for me to find through all these many views and actions offered by the profiler.
Comment 5 Boris Bokowski CLA 2010-07-03 18:01:42 EDT
You may also try Eclipse's own memory analyzer tool, see http://wiki.eclipse.org/index.php/MemoryAnalyzer and www.eclipse.org/mat
Comment 6 Stefan Mücke CLA 2010-07-03 18:36:53 EDT
Created attachment 173363 [details]
Memory profiler screenshot for leaked HashMaps

(I just took a power nap of 20 minutes; now I can think again.)

Finding the leaked objects with YourKit was a piece of cake. Just two clicks away.
Comment 7 Stefan Mücke CLA 2010-07-03 18:55:22 EDT
Created attachment 173364 [details]
Memory profiler screenshot for leaked HashMaps (allocation stack trace)

This view is probably somewhat more useful.
Comment 8 Boris Bokowski CLA 2010-07-04 00:36:49 EDT
org.eclipse.e4.ui.css.swt.properties.custom.CSSPropertyUnselectedTabsSWTHandler.applyCSSProperty(Control, String, CSSValue, String, CSSEngine) does not look right, either. Oleg, can you help Bogdan with this?
Comment 9 Oleg Besedin CLA 2010-07-06 13:36:35 EDT

*** This bug has been marked as a duplicate of bug 313950 ***