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

Bug 402742

Summary: Possible memory leak with org.eclipse.ui.texteditor.ShowWhitespaceCharactersAction
Product: [Modeling] TMF Reporter: Holger Schill <Holger.Schill>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Bernhard.Stadler, christian.dietrich.opensource, karsten.thoms, sebastian.zarnekow, sven.efftinge
Version: unspecifiedKeywords: triaged
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard:
Bug Depends on: 354538    
Bug Blocks:    

Description Holger Schill CLA 2013-03-08 09:11:27 EST
org.eclipse.xtend.ide.highlighting.ShowWhitespaceCharactersActionContributor registeres actions to the org.eclipse.jface.action.IToolBarManager.
After all editors are closed the org.eclipse.e4.ui.workbench.renderers.swt.ToolBarManagerRenderer still holds references to these actions of type org.eclipse.ui.texteditor.ShowWhitespaceCharactersAction that holds a references to org.eclipse.xtext.ui.editor.validation.XtextAnnotation with holds a reference to org.eclipse.xtext.ui.editor.model.XtextDocument.

At the end it seams not be a good idea to hold a reference to a org.eclipse.xtext.ui.editor.model.XtextDocument in a org.eclipse.xtext.ui.editor.validation.XtextAnnotation.
Steps to reproduce:

1. Enable showWhitespace and open up several big Xtend-Files.
2. Close them again.
3. Memory will not be released.
Comment 1 Sebastian Zarnekow CLA 2013-03-11 03:32:24 EDT
Since the annotation model is referenced by the document itself, I don't think the back-reference from annotations to documents are the root cause for this leak.
Comment 2 Holger Schill CLA 2013-03-11 12:21:12 EDT
Removing the action from the toolbar in org.eclipse.xtend.ide.highlighting.ShowWhitespaceCharactersActionContributor.editorDisposed(XtextEditor) does not help.

IToolBarManager toolBarManager = editor.getEditorSite().getActionBars().getToolBarManager();	toolBarManager.remove(ITextEditorActionConstants.SHOW_WHITESPACE_CHARACTERS);

org.eclipse.e4.ui.workbench.renderers.swt.ToolBarManagerRenderer still holds references to the editor.
Comment 3 Christian Dietrich CLA 2016-07-13 09:21:28 EDT
i can observe the problem when executing our xtend.ide tests with tycho
Comment 4 Christian Dietrich CLA 2016-07-15 10:22:49 EDT
https://github.com/eclipse/xtext-xtend/issues/12
Comment 5 Bernhard Stadler CLA 2016-07-30 05:51:33 EDT
Seems to be a caused by bug 354538
Comment 6 Christian Dietrich CLA 2017-02-06 01:18:53 EST
Fixed with https://git.eclipse.org/r/#/c/67267/ in Eclipse Oxygen