Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 321014 - Leaking editors; CompatibilityPart.destroy() never called
Summary: Leaking editors; CompatibilityPart.destroy() never called
Status: RESOLVED INVALID
Alias: None
Product: e4
Classification: Eclipse Project
Component: UI (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-27 09:52 EDT by Stefan Mücke CLA
Modified: 2010-07-27 10:31 EDT (History)
2 users (show)

See Also:


Attachments
Profiler screenshot: GC roots for leaked editor (98.32 KB, image/png)
2010-07-27 09:52 EDT, Stefan Mücke CLA
no flags Details
proposed patch (2.28 KB, patch)
2010-07-27 09:53 EDT, Stefan Mücke CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Mücke CLA 2010-07-27 09:52:09 EDT
Created attachment 175313 [details]
Profiler screenshot: GC roots for leaked editor

1. Remember the heap size
2. Open 20 Java editors
3. Close the Java editors

Result: Memory leak of about 6 MB.

The cause is as follows:

In method CompatibilityPart.create(), two handlers are registered at the event broker; one of them is the 'objectSetHandler'. This handler will get wrapped in a UIEventHandler and will get registered in the ServiceRegistry.

Now, when a part is closed, this listener will be notified. Then, somewhat later, method destroy() should be called and the listeners would be unregistered. However, this does not happen.

I don't know when methods with @PreDestry are meant to be destroyed. However, the problem can be fixed by moving the eventBroker.unsubscribe(...) invocations to another place (see patch).
Comment 1 Stefan Mücke CLA 2010-07-27 09:53:49 EDT
Created attachment 175315 [details]
proposed patch

This patch fixes the largest part of the leak, but there still remains some smaller leak. I will investigate...
Comment 2 Remy Suen CLA 2010-07-27 10:00:00 EDT
How are you closing these editors? I used the 'X' in the tab and Ctrl+W, in both cases, my breakpoint in the @PreDestroy'd destroy() method is hit.
Comment 3 Stefan Mücke CLA 2010-07-27 10:07:11 EDT
With the 'X' or with 'Close All' in the tab's context menu.

Now method destroy gets called. Don't know why...
Comment 4 Stefan Mücke CLA 2010-07-27 10:31:12 EDT
Marking as invalid (as long as I cannot reproduce again).