[Insight-developers] itkNeighborhood and leaks
Bill Hoffman
bill.hoffman@kitware.com
Thu, 26 Jul 2001 15:27:43 -0400
Hi all,
In looking at the purify errors, I noticed that some itkNeighborhood sub classes were being
leaked in several places. Is there some reason why this class can not inherit from
itkLightObject? If it did, it would be able to use the SmartPointer and not leak.
I don't think that any of the classes in itk should use "new", they should all use
class::New, there are several exceptions to this, but those exceptions are for classes
that need to be very small, and passed around by value or on the stack,
(in that case "new" would not be used.)
As a rule for itk, no class should be using "new" or have a public constructor unless it is
to be used on the stack or as part of an array.
Here are the remaining tests that have leaks:
itkDeformableTest
itkDiscreteGaussianImageFilterTest
itkExceptionObjectTest
itkGibbsTest
itkMRFLabellerTest
itkSplineKernelTransformTest
itkSupervisedClassifierTest
itkVectorFuzzyConnectednessImageFilterTest
itkVoronoiSegmentationImageFilterTest
itkVoronoi2DDiagramTest
Interestingly, if you grep in the source code for "new " *.txx *.cxx, most of the classes that
use "new" are the ones that are leaking memory.
-Bill