View Issue Details

IDProjectCategoryView StatusLast Update
0002262Slicer4Core: Base Codepublic2012-08-21 09:47
Reporterjcfr Assigned Tojcfr  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version 
Target VersionSlicer 4.2.0Fixed in VersionSlicer 4.2.0 
Summary0002262: Fix memory leaks associated with ModelDisplayableManager refactor
Description

vtkDebugLeaks has detected LEAKS!
Class "vtkSynchronizedTemplatesCutter3D" has 6 instances still around.
Class "vtkTransformPolyDataFilter" has 6 instances still around.
Class "vtkInformationVector" has 126 instances still around.
Class "vtkMatrix4x4" has 21 instances still around.
Class "vtkCoordinate" has 12 instances still around.
Class "vtkPlane" has 6 instances still around.
Class "vtkInformation" has 150 instances still around.
Class "vtkSynchronizedTemplates3D" has 6 instances still around.
Class "vtkActor2D" has 6 instances still around.
Class "vtkRectilinearSynchronizedTemplates" has 6 instances still around.
Class "vtkDoubleArray" has 30 instances still around.
Class "vtkAlgorithmOutput" has 6 instances still around.
Class "vtkInformationIntegerValue" has 108 instances still around.
Class "vtkOpenGLPolyDataMapper2D" has 6 instances still around.
Class "vtkGridSynchronizedTemplates3D" has 6 instances still around.
Class "vtkCutter" has 6 instances still around.
Class "vtkInformationExecutivePortVectorValue" has 6 instances still around.
Class "vtkContourValues" has 30 instances still around.
Class "vtkTransform" has 6 instances still around.
Class "vtkStreamingDemandDrivenPipeline" has 12 instances still around.
Class "vtkTimerLog" has 6 instances still around.
Class "vtkInformationExecutivePortValue" has 6 instances still around.

TagsNo tags attached.

Relationships

related to 0001384 closedinorton Slice intersections only work in green viewer 
related to 0001536 closedalexy Model slice intersections do not work 
related to 0001632 closedinorton Slice intersections are not working consistently 
related to 0001650 closedinorton Model intersection doesn't show up on slice when adding the model in a module 

Activities

inorton

inorton

2012-06-26 21:12

developer   ~0004944

I know where most of these are from, but I can't actually see the debugleaks messages due to crash on exit 0002204. Will test tomorrow on a different machine.

jcfr

jcfr

2012-06-27 12:51

administrator   ~0004951

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

jcfr

jcfr

2012-06-27 13:01

administrator   ~0004952

See also http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=20502

pieper

pieper

2012-06-28 07:36

administrator   ~0004965

The change in the use of the iterator leads to a crash.

See bottom change on this page:

http://viewvc.slicer.org/viewvc.cgi/Slicer4/trunk/Libs/MRML/DisplayableManager/vtkMRMLModelSliceDisplayableManager.cxx?r1=20500&r2=20501

I reverted this with:

http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=20508

Here is the crash I was getting on windows:

msvcp90d.dll!std::_Debug_message(const wchar_t message=0x000007fe6c2c8be0, const wchar_t file=0x000007fe6c2c2850, unsigned int line=384) Line 24 C++
MRMLDisplayableManager.dll!std::_Tree<std::_Tmap_traits<vtkMRMLDisplayNode __ptr64,vtkMRMLModelSliceDisplayableManager::vtkInternal::Pipeline const ptr64,std::less<vtkMRMLDisplayNode * ptr64>,std::allocator<std::pair<vtkMRMLDisplayNode __ptr64 const,vtkMRMLModelSliceDisplayableManager::vtkInternal::Pipeline const __ptr64> >,0> >::const_iterator::_Inc() Line 385 C++
MRMLDisplayableManager.dll!std::_Tree<std::_Tmap_traits<vtkMRMLDisplayNode __ptr64,vtkMRMLModelSliceDisplayableManager::vtkInternal::Pipeline const ptr64,std::less<vtkMRMLDisplayNode * ptr64>,std::allocator<std::pair<vtkMRMLDisplayNode __ptr64 const,vtkMRMLModelSliceDisplayableManager::vtkInternal::Pipeline const ptr64> >,0> >::const_iterator::operator++() Line 275 C++
MRMLDisplayableManager.dll!std::_Tree<std::_Tmap_traits<vtkMRMLDisplayNode *
ptr64,vtkMRMLModelSliceDisplayableManager::vtkInternal::Pipeline const __ptr64,std::less<vtkMRMLDisplayNode ptr64>,std::allocator<std::pair<vtkMRMLDisplayNode * ptr64 const,vtkMRMLModelSliceDisplayableManager::vtkInternal::Pipeline const __ptr64> >,0> >::iterator::operator++() Line 476 C++
MRMLDisplayableManager.dll!vtkMRMLModelSliceDisplayableManager::vtkInternal::ClearDisplayableNodes() Line 453 + 0xa bytes C++
MRMLDisplayableManager.dll!vtkMRMLModelSliceDisplayableManager::UpdateFromMRML() Line 634 C++
MRMLDisplayableManager.dll!vtkMRMLAbstractDisplayableManager::RequestRender() Line 700 C++
MRMLDisplayableManager.dll!vtkMRMLModelSliceDisplayableManager::ProcessMRMLNodesEvents(vtkObject
caller=0x00000000135e7140, unsigned long event=33, void callData=0x0000000000000000) Line 615 C++
MRMLLogic.dll!vtkMRMLAbstractLogic::MRMLNodesCallback(vtkObject
caller=0x00000000135e7140, unsigned long eid=33, void clientData=0x0000000013addb60, void callData=0x0000000000000000) Line 185 C++
vtkCommon.dll!vtkCallbackCommand::Execute(vtkObject caller=0x00000000135e7140, unsigned long event=33, void callData=0x0000000000000000) Line 43 C++
MRMLCore.dll!vtkEventBroker::InvokeObservation(vtkObservation observation=0x0000000013b8e8f0, void callData=0x0000000000000000) Line 857 C++
MRMLCore.dll!vtkEventBroker::ProcessEvent(vtkObservation observation=0x0000000013b8e8f0, vtkObject caller=0x00000000135e7140, unsigned long eid=33, void callData=0x0000000000000000) Line 707 + 0x1d bytes C++
MRMLCore.dll!vtkEventBroker::Callback(vtkObject
caller=0x00000000135e7140, unsigned long eid=33, void clientData=0x0000000013b8e8f0, void callData=0x0000000000000000) Line 929 C++
vtkCommon.dll!vtkCallbackCommand::Execute(vtkObject caller=0x00000000135e7140, unsigned long event=33, void callData=0x0000000000000000) Line 43 C++
vtkCommon.dll!vtkSubjectHelper::InvokeEvent(unsigned long event=33, void callData=0x0000000000000000, vtkObject self=0x00000000135e7140) Line 605 C++
vtkCommon.dll!vtkObject::InvokeEvent(unsigned long event=33, void callData=0x0000000000000000) Line 770 + 0x1c bytes C++
vtkCommon.dll!vtkObject::Modified() Line 837 C++
MRMLCore.dll!vtkMRMLNode::InvokePendingModifiedEvent() Line 366 C++
MRMLCore.dll!vtkMRMLNode::EndModify(int previousDisableModifiedEventState=0) Line 213 + 0x13 bytes C++
MRMLCore.dll!vtkMRMLSliceNode::UpdateMatrices() Line 578 C++
MRMLCore.dll!vtkMRMLSliceNode::SetUVWExtentsAndDimensions(double
extents=0x0000000000a2ce88, int dimensions=0x0000000000a2ceb8) Line 1484 C++
MRMLLogic.dll!vtkMRMLSliceLogic::SetSliceExtentsToSliceNode() Line 2110 C++
MRMLLogic.dll!vtkMRMLSliceLogic::OnMRMLNodeModified(vtkMRMLNode
node=0x00000000135e7140) Line 474 C++
MRMLLogic.dll!vtkMRMLAbstractLogic::ProcessMRMLNodesEvents(vtkObject caller=0x00000000135e7140, unsigned long event=33, void formal=0x0000000000000000) Line 453 C++
MRMLLogic.dll!vtkMRMLAbstractLogic::MRMLNodesCallback(vtkObject caller=0x00000000135e7140, unsigned long eid=33, void clientData=0x0000000013a80900, void callData=0x0000000000000000) Line 185 C++
vtkCommon.dll!vtkCallbackCommand::Execute(vtkObject
caller=0x00000000135e7140, unsigned long event=33, void callData=0x0000000000000000) Line 43 C++
MRMLCore.dll!vtkEventBroker::InvokeObservation(vtkObservation
observation=0x0000000013af8740, void callData=0x0000000000000000) Line 857 C++
MRMLCore.dll!vtkEventBroker::ProcessEvent(vtkObservation
observation=0x0000000013af8740, vtkObject caller=0x00000000135e7140, unsigned long eid=33, void callData=0x0000000000000000) Line 707 + 0x1d bytes C++
MRMLCore.dll!vtkEventBroker::Callback(vtkObject caller=0x00000000135e7140, unsigned long eid=33, void clientData=0x0000000013af8740, void callData=0x0000000000000000) Line 929 C++
vtkCommon.dll!vtkCallbackCommand::Execute(vtkObject
caller=0x00000000135e7140, unsigned long event=33, void callData=0x0000000000000000) Line 43 C++
vtkCommon.dll!vtkSubjectHelper::InvokeEvent(unsigned long event=33, void
callData=0x0000000000000000, vtkObject self=0x00000000135e7140) Line 605 C++
vtkCommon.dll!vtkObject::InvokeEvent(unsigned long event=33, void
callData=0x0000000000000000) Line 770 + 0x1c bytes C++
vtkCommon.dll!vtkObject::Modified() Line 837 C++
MRMLCore.dll!vtkMRMLNode::InvokePendingModifiedEvent() Line 366 C++
MRMLCore.dll!vtkMRMLNode::EndModify(int previousDisableModifiedEventState=0) Line 213 + 0x13 bytes C++
MRMLLogic.dll!vtkMRMLSliceLogic::ResizeSliceNode(double newWidth=390.00000000000000, double newHeight=234.00000000000000) Line 1870 C++
qMRMLWidgets.dll!qMRMLSliceControllerWidget::setSliceViewSize(const QSize & newSize={...}) Line 1338 C++
qMRMLWidgets.dll!qMRMLSliceControllerWidget::qt_metacall(QMetaObject::Call _c=InvokeMetaMethod, int _id=5, void _a=0x0000000000a2db68) Line 198 + 0x19 bytes C++
QtCored4.dll!QMetaObject::metacall(QObject object=0x00000000139ca850, QMetaObject::Call cl=InvokeMetaMethod, int idx=34, void argv=0x0000000000a2db68) Line 238 C++
QtCored4.dll!QMetaObject::activate(QObject
sender=0x0000000013a91640, const QMetaObject m=0x000007fe69885b18, int local_signal_index=0, void argv=0x0000000000a2db68) Line 3278 + 0x49 bytes C++
CTKVisualizationVTKWidgets.dll!ctkVTKSliceView::resized(const QSize & _t1={...}) Line 163 C++
CTKVisualizationVTKWidgets.dll!ctkVTKSliceView::resizeEvent(QResizeEvent
event=0x0000000000a2e830) Line 230 C++
QtGuid4.dll!QWidget::event(QEvent event=0x0000000000a2e830) Line 8450 C++
QtGuid4.dll!QApplicationPrivate::notify_helper(QObject
receiver=0x0000000013a91640, QEvent e=0x0000000000a2e830) Line 4481 + 0x15 bytes C++
QtGuid4.dll!QApplication::notify(QObject
receiver=0x0000000013a91640, QEvent e=0x0000000000a2e830) Line 4446 + 0x1d bytes C++
QtCored4.dll!QCoreApplication::notifyInternal(QObject
receiver=0x0000000013a91640, QEvent event=0x0000000000a2e830) Line 787 + 0x26 bytes C++
QtCored4.dll!QCoreApplication::sendEvent(QObject
receiver=0x0000000013a91640, QEvent event=0x0000000000a2e830) Line 215 + 0x50 bytes C++
QtGuid4.dll!QWidgetPrivate::sendPendingMoveAndResizeEvents(bool recursive=false, bool disableUpdates=false) Line 7366 C++
QtGuid4.dll!QWidgetPrivate::show_helper() Line 7419 C++
QtGuid4.dll!QWidget::setVisible(bool visible=true) Line 7700 C++
QtGuid4.dll!QWidget::show() Line 487 + 0x1b bytes C++
QtGuid4.dll!QWidgetPrivate::showChildren(bool spontaneous=false) Line 7787 C++
QtGuid4.dll!QWidgetPrivate::show_helper() Line 7425 C++
QtGuid4.dll!QWidget::setVisible(bool visible=true) Line 7700 C++
QtGuid4.dll!QWidget::show() Line 487 + 0x1b bytes C++
QtGuid4.dll!QWidgetPrivate::showChildren(bool spontaneous=false) Line 7787 C++
QtGuid4.dll!QWidgetPrivate::show_helper() Line 7425 C++
QtGuid4.dll!QWidget::setVisible(bool visible=true) Line 7700 C++
QtGuid4.dll!QWidget::show() Line 487 + 0x1b bytes C++
QtGuid4.dll!QWidgetPrivate::showChildren(bool spontaneous=false) Line 7787 C++
QtGuid4.dll!QWidgetPrivate::show_helper() Line 7425 C++
QtGuid4.dll!QWidget::setVisible(bool visible=true) Line 7700 C++
QtGuid4.dll!QWidget::show() Line 487 + 0x1b bytes C++
QtGuid4.dll!QWidgetPrivate::showChildren(bool spontaneous=false) Line 7787 C++
QtGuid4.dll!QWidgetPrivate::show_helper() Line 7425 C++
QtGuid4.dll!QWidget::setVisible(bool visible=true) Line 7700 C++
QtGuid4.dll!QWidget::show() Line 487 + 0x1b bytes C++
QtGuid4.dll!QWidgetPrivate::showChildren(bool spontaneous=false) Line 7787 C++
QtGuid4.dll!QWidgetPrivate::show_helper() Line 7425 C++
QtGuid4.dll!QWidget::setVisible(bool visible=true) Line 7700 C++
QtGuid4.dll!QWidget::show() Line 487 + 0x1b bytes C++
QtGuid4.dll!QWidgetPrivate::showChildren(bool spontaneous=false) Line 7787 C++
QtGuid4.dll!QWidgetPrivate::show_helper() Line 7425 C++
QtGuid4.dll!QWidget::setVisible(bool visible=true) Line 7700 C++
QtGuid4.dll!QWidget::show() Line 487 + 0x1b bytes C++
QtGuid4.dll!QWidgetPrivate::showChildren(bool spontaneous=false) Line 7787 C++
QtGuid4.dll!QWidgetPrivate::show_helper() Line 7425 C++
QtGuid4.dll!QWidget::setVisible(bool visible=true) Line 7700 C++
QtGuid4.dll!QWidget::show() Line 487 + 0x1b bytes C++
SlicerApp-real.exe!`anonymous namespace'::SlicerAppMain(int argc=1, char
* argv=0x0000000003ed62b0) Line 296 C++
SlicerApp-real.exe!WinMain(HINSTANCE
hInstance=0x000000013fec0000, HINSTANCE__ hPrevInstance=0x0000000000000000, char * lpCmdLine=0x0000000000a66d5b, int nShowCmd=1) Line 327 + 0xe bytes C++
SlicerApp-real.exe!__tmainCRTStartup() Line 574 + 0x42 bytes C
SlicerApp-real.exe!WinMainCRTStartup() Line 399 C
kernel32.dll!000000007702652d()
[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
ntdll.dll!000000007715c521()

jcfr

jcfr

2012-06-28 10:45

administrator   ~0004974

Thanks Steve

ENH: Improve readability using "while" construct when removing item from std::map
See http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&amp;revision=20512

finetjul

finetjul

2012-06-28 17:34

administrator   ~0004983

My 2 cents on the loop that has been touched 5x by 4 people in 1 week :-P
:

  • I liked the "for" version better, that was more "readable" to me (instead of pre-incrementing an iterator because the current position gets erased).
  • ++displayPipelineIt is not necessary (and confusing) because you only need to remove the first item at each iteration
    -> while (this->DisplayPipelines.size() > 0){this->RemoveDisplayNode(this->DisplayPipelines.begin()->first);}
jcfr

jcfr

2012-06-29 07:07

administrator   ~0004989

Indeed ... the initial version confused me, while trying to fix leaks I updated it. Then Steve (Thanks to him) fixed the regression I introduced.

Then I attempted to make it more clear introducing the "while" loop + "IteratorToErase" variable

Your version is indeed even simpler :) Fixed in http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&amp;revision=20518

Thanks Julien

Issue History

Date Modified Username Field Change
2012-06-26 13:11 jcfr New Issue
2012-06-26 13:11 jcfr Status new => assigned
2012-06-26 13:11 jcfr Assigned To => inorton
2012-06-26 13:12 jcfr Relationship added related to 0001384
2012-06-26 13:12 jcfr Relationship added related to 0001536
2012-06-26 13:12 jcfr Relationship added related to 0001632
2012-06-26 13:12 jcfr Relationship added related to 0001650
2012-06-26 21:12 inorton Note Added: 0004944
2012-06-26 21:12 inorton Status assigned => acknowledged
2012-06-27 12:49 jcfr Status acknowledged => assigned
2012-06-27 12:49 jcfr Assigned To inorton => jcfr
2012-06-27 12:51 jcfr Note Added: 0004951
2012-06-27 12:51 jcfr Status assigned => resolved
2012-06-27 12:51 jcfr Fixed in Version => Slicer 4.2.0 - Sept 1st 2012
2012-06-27 12:51 jcfr Resolution open => fixed
2012-06-27 13:01 jcfr Note Added: 0004952
2012-06-28 07:36 pieper Note Added: 0004965
2012-06-28 10:45 jcfr Note Added: 0004974
2012-06-28 17:34 finetjul Note Added: 0004983
2012-06-29 07:07 jcfr Note Added: 0004989
2012-07-27 15:23 jcfr Status resolved => closed
2012-08-21 09:47 jcfr Target Version => Slicer 4.2.0 - Feature freeze Sept 1st 2012