So while studying MITK Undo/Redo code, I noticed that there's no cleanup of the vtkPolyData in mitk::SurfaceOperation. When the Undo model purges the stack of OperationEvents there will be a memory leak unless the vtkPolyData is referenced somewhere else.
https://docs.mitk.org/nightly/mitkSurfaceOperation_8h_source.html And the way SurfaceOperation works is to simply replace the vtkPolyData in a Surface object. So if you're implementing a really cool and extremely efficient mesh-based segmentation annotation tool for organs and other blob-like structures... you're probably going to want to keep separate deep copies of vtkPolyData around in SurfaceOperations for Undo/Redo. That's not going to work out well with raw pointers. I'm admittedly a newbie MITK user/developer. Is there a reason for SurfaceOperation not using vtkSmartPointer for its poly data? Otherwise I'm inclined to create a pull request! I changed it on my end and the Undo/Redo works perfectly with less worry of leaking VTK data structure memory. Best regards, Nathan Lay
_______________________________________________ mitk-users mailing list mitk-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mitk-users