| Summary: | Leaking editors; CompatibilityPart.destroy() never called | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] e4 | Reporter: | Stefan Mücke <s.muecke> | ||||||
| Component: | UI | Assignee: | Project Inbox <e4.ui-inbox> | ||||||
| Status: | RESOLVED INVALID | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | bokowski, remy.suen | ||||||
| Version: | unspecified | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows 7 | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
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...
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. With the 'X' or with 'Close All' in the tab's context menu. Now method destroy gets called. Don't know why... Marking as invalid (as long as I cannot reproduce again). |
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).