View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002718 | Slicer4 | Core: Base Code | public | 2012-11-01 12:49 | 2013-07-08 09:58 |
Reporter | lassoan | Assigned To | pieper | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | assigned | Resolution | open | ||
Product Version | |||||
Target Version | Fixed in Version | ||||
Summary | 0002718: Memory leaks when returning vtkCollection objects to Python as return value | ||||
Description | After several days of searching for a memory leak we've found out that the following Python code causes the memory leak: scene.GetNodesByClass("vtkMRMLScalarVolumeNode").GetNumberOfItems() > 1 Even if we save the GetNodesByClass output into a variable and then call Delete() or UnRegister, the leak is still there. The problem is that in vtkMRMLScene::GetNodesByClass a new vtkCollection object is created, which should be deleted by the caller. However, this is counter-intuitive (if vtkMRMLScene created the vtkCollection object then vtkMRMLScene should be responsible for the deletion as well) and very error-prone (as our example showed it). To avoid such issues, the signature of I've reviewed the full Slicer code base and found that two other classes has the same issue. The complete list of methods that should be fixed: vtkCollection vtkMRMLScene::GetNodesByClass(const char className) vtkCollection vtkMRMLLayoutLogic::GetViewsFromLayout(vtkXMLDataElement root) vtkCollection vtkEventBroker::GetObservationsForSubject ( vtkObject subject ) | ||||
Tags | No tags attached. | ||||
Another issue seems to confirm that the current way of returning vtkCollection is very error-prone: http://www.na-mic.org/Bug/view.php?id=2512. |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2012-11-01 12:49 | lassoan | New Issue | |
2012-11-01 12:49 | lassoan | Status | new => assigned |
2012-11-01 12:49 | lassoan | Assigned To | => pieper |
2012-11-01 15:28 | pieper | Target Version | => Slicer 4.3.0 |
2012-11-04 19:10 | lassoan | Note Added: 0007044 | |
2012-11-05 02:51 | pieper | Relationship added | related to 0002512 |
2013-07-08 09:58 | pieper | Target Version | Slicer 4.3.0 => |