View Issue Details

IDProjectCategoryView StatusLast Update
0003515Slicer4Core: Base Codepublic2017-06-10 08:51
Reporterlassoan Assigned Tojcfr  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version 
Target VersionSlicer 4.4.0Fixed in VersionSlicer 4.4.0 
Summary0003515: Scene view memory leak when exiting Slicer
Description

There is a memory leak when closing a scene that has been loaded from an .mrb file.

Root cause:
When an mrb file is opened the SceneViewTopLevel node saved with the scene is loaded into the scene, but its singleton tag is not set. For other singleton nodes (views, units, etc.) that singleton tag is set in the constructor orin ReadXMLAttributes, but the SceneViewTopLevel node is a simple hierarchy node, therefore the singleton tag cannot be set in the vtkMRMLHierarchyNode::vtkMRMLHierarchyNode or vtkMRMLHierarchyNode::ReadXMLAttributes. When we save the scene, a new SceneViewTopLevel is created, because no singleton SceneViewTopLevel node is found, and then this new node added to the scene WITH THE SAME ID as the non-singleton SceneViewTopLevel node!!! This of course breaks the whole node ID caching mechanism and causes leaks and all kinds of other problems (e.g., empty scene view list, etc).

TagsToBeBackported

Activities

lassoan

lassoan

2013-11-27 11:54

developer   ~0010391

Proposed fix:

https://github.com/Slicer/Slicer/pull/88

  1. To prevent having a singleton and a non-singleton node in the scene with the same ID: When we look for a singleton node we check if we can find any non-singleton node that has an ID that matches the singleton node ID. If a non-singleton-node with a singleton ID is found then that non-singleton-node is converted to singleton and a warning is logged.
  2. To prevent logging a warning due to missing singleton tag: if the singleton node tag is missing for SceneViewTopLevel node then we add it in vtkSlicerSceneViewsModuleLogic.

A nicer solution would be to make a new class for SceneViewTopLevel node and set it as a singleton node in its constructor. However, we would still need to have the singleton node adding workaround for old scene files.

jcfr

jcfr

2013-12-02 14:14

administrator   ~0010396

Fixed in r22754
See http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=22754

jcfr

jcfr

2014-03-06 05:03

administrator   ~0010893

Closing resolved issues that have not been updated in more than 3 months

jcfr

jcfr

2017-06-07 23:27

administrator   ~0014563

Fix committed to 2145-support-for-installing-extension-from-file branch.

Related Changesets

Slicer: 2145-support-for-installing-extension-from-file 5619805f

2013-12-02 19:13:02

jcfr

Details Diff
BUG: Fixed scene view node memory leak. Fixes 0003515

From: Andras Lasso <lasso@queensu.ca>

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22754 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Libs/MRML/Core/vtkMRMLScene.cxx Diff File
mod - Libs/MRML/Core/vtkMRMLScene.h Diff File
mod - Libs/MRML/Core/vtkMRMLSceneViewNode.cxx Diff File
mod - Modules/Loadable/SceneViews/Logic/vtkSlicerSceneViewsModuleLogic.cxx Diff File

Import 2017-06-07 23:51:09: master 5619805f

2013-12-02 19:13:02

jcfr

Details Diff
BUG: Fixed scene view node memory leak. Fixes 0003515

From: Andras Lasso <lasso@queensu.ca>

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22754 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Libs/MRML/Core/vtkMRMLScene.cxx Diff File
mod - Libs/MRML/Core/vtkMRMLScene.h Diff File
mod - Libs/MRML/Core/vtkMRMLSceneViewNode.cxx Diff File
mod - Modules/Loadable/SceneViews/Logic/vtkSlicerSceneViewsModuleLogic.cxx Diff File

Issue History

Date Modified Username Field Change
2013-11-27 11:48 lassoan New Issue
2013-11-27 11:48 lassoan Status new => assigned
2013-11-27 11:48 lassoan Assigned To => jcfr
2013-11-27 11:54 lassoan Note Added: 0010391
2013-12-02 12:07 jcfr Target Version => Slicer 4.4.0
2013-12-02 12:07 jcfr Target Version Slicer 4.4.0 => Slicer 4.3.2
2013-12-02 14:14 jcfr Tag Attached: ToBeBackported
2013-12-02 14:14 jcfr Note Added: 0010396
2013-12-02 14:14 jcfr Status assigned => resolved
2013-12-02 14:14 jcfr Fixed in Version => Slicer 4.4.0
2013-12-02 14:14 jcfr Resolution open => fixed
2014-03-06 05:03 jcfr Note Added: 0010893
2014-03-06 05:03 jcfr Status resolved => closed
2014-03-06 10:16 nicole Target Version Slicer 4.3.2 => Slicer 4.4.0
2017-06-07 23:27 jcfr Changeset attached => Slicer 2145-support-for-installing-extension-from-file 5619805f
2017-06-07 23:27 jcfr Note Added: 0014563
2017-06-10 08:51 jcfr Changeset attached => Slicer master 5619805f