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

Bug 454887

Summary: SessionEditorInput is not disposed at table (or tree) editor closing
Product: [Modeling] Sirius Reporter: Laurent Redor <laurent.redor>
Component: CoreAssignee: Laurent Redor <laurent.redor>
Status: CLOSED FIXED QA Contact: Maxime Porhel <maxime.porhel>
Severity: normal    
Priority: P3 CC: belqassim.djafer, maxime.porhel, pierre-charles.david
Version: 0.9Keywords: triaged
Target Milestone: 3.0.0M4   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 456055    
Attachments:
Description Flags
ModelingProjectWithTree.zip none

Description Laurent Redor CLA 2014-12-11 08:55:58 EST
The SessionEditorInput is disposed at diagram closing [1]. But, this is not done for tree or table.

This can cause leak from INavigationHistory and EditorHistory that retain the IEditorInput.

[1] http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/tree/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/DDiagramEditorImpl.java#n723
Comment 2 Laurent Redor CLA 2014-12-12 05:03:10 EST
The initial reproduction case is complex (launch the SWTBot tests suite, ...). Here is a simpler reproduction case but not exactly as the initial detection.

Steps to validate the fix:
* Launch Sirius with Yourkit (for example)
* Close the Properties view (this view retains some ItemWrapper, that let think to memory leak, but the "leak" is true only until the next selection of an EObject or another ItemWrapper).
* Import the project ModelingProjectWithTree (from ModelingProjectWithTree.zip)
* Open the myTree representation
* Look in Yourkit, there is only one instance of DAnalysisSessionImpl. This instance is retained by the SessionEditorInput that is itself retained by an EditorHistoryItem (you can do a memory snapshot to see that).
* Close representation 
* Close the session (ie close the project)
* Look in Yourkit, there is always one instance of DAnalysisSessionImpl (launch the garbage collector to be sure) but only retained by weak/soft references (you can do a memory snapshot to see that).
Comment 3 Laurent Redor CLA 2014-12-12 05:06:05 EST
The commit [1] is also a candidate for backport. This commit has been fixed without issue but during the same "tests" leak analysis.

[1] http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=9c70c327f2de38dae9e62d24644024696e11af5b
Comment 4 Pierre-Charles David CLA 2014-12-23 04:24:41 EST
Cloned as bug #456055 to backport both fixes (see comment 1 and comment 3) into Sirius 2.0.x.
Comment 5 Laurent Redor CLA 2015-01-20 05:30:39 EST
Created attachment 250072 [details]
ModelingProjectWithTree.zip
Comment 6 Belqassim Djafer CLA 2015-04-08 11:12:08 EDT
Verified on Sirius 3.0.0M6
Comment 7 Maxime Porhel CLA 2015-05-22 04:14:01 EDT
Validated on Sirius 3.0.0 RC1
Comment 8 Pierre-Charles David CLA 2015-06-24 11:12:30 EDT
Available in Sirius 3.0.0. See https://wiki.eclipse.org/Sirius/3.0.0.