[Insight-developers] itkNeighborhood and leaks

Bill Hoffman bill.hoffman@kitware.com
Thu, 26 Jul 2001 16:28:48 -0400


The IRIX purify is very broken, in fact, I would say it does not work at all.

"several places" may have been only one, but the point is I see no reason why this
class should be an exception to the coding standards.   If it used ::New, the leak
would not be there.   Is there a good reason for this class not to be an itkLightObject?

-Bill


At 02:21 PM 7/26/2001 -0600, Joshua Cates wrote:
>Hi,
>
>The only MLK I see associated with itkNeighborhood is 96 bytes in
>itkDiscreteGaussianImageFilterTest.  Are there other places that I am
>overlooking?  Oddly, this leak does not appear in the Irix run.
>
>Josh.
>
>_____________________________
> Josh Cates                     
> School of Computer Science     
> University of Utah
> Email: cates@cs.utah.edu
> Phone: (801) 587-7697
> URL:   www.cs.utk.edu/~cates
>
>
>On Thu, 26 Jul 2001, Bill Hoffman wrote:
>
>> 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
>> 
>> 
>> _______________________________________________
>> Insight-developers mailing list
>> Insight-developers@public.kitware.com
>> http://public.kitware.com/mailman/listinfo/insight-developers
>>