[vtk-developers] vtkLoopSubdivisionFilter
David Doria
daviddoria at gmail.com
Mon Jul 18 14:25:47 EDT 2011
On Mon, Jul 18, 2011 at 2:20 PM, Laurent Chauvin
<lchauvin at bwh.harvard.edu>wrote:
> Hello,
>
> I was using vtkLoopSubdivisionFilter, but after leaving Slicer I got
> hundred of thousands of vtkIdList leaks.
>
> After debugging, the problem seems to come from this part of code:
>
> void vtkLoopSubdivisionFilter::GenerateEvenStencil (vtkIdType p1,
> vtkPolyData *polys,
> vtkIdList *stencilIds,
> double *weights)
> {
> vtkIdList *cellIds = vtkIdList::New();
> vtkIdList *ptIds = vtkIdList::New();
> vtkCell *cell;
>
> int i, j;
> int numCellsInLoop;
> int startCell, nextCell;
> vtkIdType p, p2;
> vtkIdType bp1, bp2;
> int K;
> double beta, cosSQ;
>
> // Get the cells that use this point
> polys->GetPointCells (p1, cellIds);
> numCellsInLoop = cellIds->GetNumberOfIds();
> if (numCellsInLoop < 1)
> {
> vtkWarningMacro("numCellsInLoop < 1: " << numCellsInLoop);
> stencilIds->Reset();
>
> // Test Remove vtkIdList
> cellIds->Delete();
> ptIds->Delete();
> // End Test
>
> return;
> }
> // Find an edge to start with that contains p1
>
> ...
> cellIds->Delete();
> ptsIds->Delete();
> }
>
> If we return before the end of the function, the cellIds and ptsId are not
> deleted (creating leaks).
> I had the code between comments "Test Remove vtkIdList" and "End Test".
>
> Leaks are gone.
>
> I just would like to know if it was a mistake or if there is a reason for
> not deleting before returning ?
>
> Thank you.
> -Laurent
>
> --
> Laurent Chauvin, MS
>
Seems like an oversight. I've seen that same type of thing in one or two
cases before. That seems to be the right fix to me.
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20110718/dc9904ce/attachment.html>
More information about the vtk-developers
mailing list