Project: Eclipse_Platform_UI
Bug 391138 Memory leaks in Juno when opening and closing Java Editor
Reported: 2012-10-04 12:58:27 | Status: resolved fixed

I have noticed three memory leaks when opening and closing the Java editor 1) PartRenderingEngine adds MUIElement-s to the renderedElements list, but doesn't remove them correctly. All the OpaqueToolItemImpl toolbar items are leaked 2) ToolbarManagerRenderer.getUIContainer(MUIElement) doesn't find any container for the elements of the ToolBar type and creates a new toolbar that is never disposed. This leak has been introduced by Eclipse 4.2.1 3) This issue can be reproduced when adding WTP 3.4.x. The JavaOutlinePage class is disposed before disposing the JavaEditor class. WTP's CustomFilterPropertyTester calls JavaEditor.getAdapter(IContentOutlinePage.class) when JavaOutlinePage is disposed and the Java Editor isn't disposed yet. In this case, the Java Editor creates a new JavaOutlinePage that is never disposed. Attached are patches.

Files changed in fix:
bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/PartRenderingEngine.java