[vtk-developers] vtkLoopSubdivisionFilter

Bill Lorensen bill.lorensen at gmail.com
Mon Jul 18 14:27:32 EDT 2011


It would be great if you could provide a gerrit patch following these
instructions:
http://itk.org/Wiki/VTK/Git#Gerrit

and please let us know if the instructions are correct.

Bill

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
> Surgical Planning Laboratory, Radiology
> Brigham And Women's Hospital, Harvard Medical School
> http://wiki.ncigt.org/index.php/User:Lchauvin
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>
>



More information about the vtk-developers mailing list