View Issue Details

IDProjectCategoryView StatusLast Update
0003164Slicer4Core: MRMLpublic2013-07-17 11:51
Reporterluis Assigned Tonicole  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionno change required 
Product VersionSlicer 4.2.0 
Target VersionSlicer 4.3.0Fixed in VersionSlicer 4.3.0 
Summary0003164: Adding fiducial nodes via python creates memory leaks
Description

On the nightly version of Slicer, you can reproduce this bug by opening the python interactive console and entering:

f = slicer.vtkMRMLAnnotationFiducialNode()
f.SetFiducialCoordinates(0,0,0)
slicer.mrmlScene.AddNode(f)

Upon exiting, a whole bunch of VTK memory leaks will be reported:

vtkDebugLeaks has detected LEAKS!
Class vtkSynchronizedTemplatesCutter3D has 3 instances still around.
Class vtkTransformPolyDataFilter has 3 instances still around.
Class vtkInformationVector has 63 instances still around.
Class vtkMatrix4x4 has 6 instances still around.
Class vtkCoordinate has 6 instances still around.
Class vtkPlane has 3 instances still around.
Class vtkInformation has 75 instances still around.
Class vtkSynchronizedTemplates3D has 3 instances still around.
Class vtkActor2D has 3 instances still around.
Class vtkRectilinearSynchronizedTemplates has 3 instances still around.
Class vtkDoubleArray has 15 instances still around.
Class vtkAlgorithmOutput has 3 instances still around.
Class vtkInformationIntegerValue has 54 instances still around.
Class vtkOpenGLPolyDataMapper2D has 3 instances still around.
Class vtkGridSynchronizedTemplates3D has 3 instances still around.
Class vtkCutter has 3 instances still around.
Class vtkInformationExecutivePortVectorValue has 3 instances still around.
Class vtkContourValues has 15 instances still around.
Class vtkTransform has 3 instances still around.
Class vtkStreamingDemandDrivenPipeline has 6 instances still around.
Class vtkTimerLog has 3 instances still around.
Class vtkInformationExecutivePortValue has 3 instances still around.

TagsNo tags attached.

Relationships

related to 0003138 closednicole Fiducials not displaying correctly in slice viewers 

Activities

nicole

nicole

2013-06-13 09:57

administrator   ~0008762

Use the Initialize method instead of AddNode to avoid memory leaks:
f = slicer.vtkMRMLAnnotationFiducialNode()
f.SetFiducialCoordinates(0,0,0)
f.Initialize(slicer.mrmlScene)

luis

luis

2013-06-13 10:16

developer   ~0008763

Thanks Nicole, that fixed the memory leak! Is there a reason why the interface for safely adding annotation nodes to the scene is so different from adding any other type of node?

nicole

nicole

2013-07-17 11:51

administrator   ~0009109

Original design decisions made before I took over maintenance of the module.
I added a utility method for adding new fiducials, after tonight's build you can do:
fidID = slicer.modules.annotations.logic().AddFiducial(10.0, -50.0, 8.8, 'P1')
f = getNode(fidID)

Issue History

Date Modified Username Field Change
2013-06-13 08:01 luis New Issue
2013-06-13 08:01 luis Status new => assigned
2013-06-13 08:01 luis Assigned To => alexy
2013-06-13 09:57 nicole Note Added: 0008762
2013-06-13 09:57 nicole Status assigned => resolved
2013-06-13 09:57 nicole Resolution open => no change required
2013-06-13 09:57 nicole Status resolved => assigned
2013-06-13 09:57 nicole Assigned To alexy => nicole
2013-06-13 09:58 nicole Status assigned => resolved
2013-06-13 10:16 luis Note Added: 0008763
2013-06-13 20:25 jcfr Target Version => Slicer 4.3.0
2013-07-17 11:50 nicole Relationship added related to 0003138
2013-07-17 11:51 nicole Note Added: 0009109
2013-07-17 11:51 nicole Status resolved => closed
2013-07-17 11:51 nicole Fixed in Version => Slicer 4.3.0