[Insight-developers] purify errors on VC++

Lydia Ng lng@insightful.com
Thu, 19 Jul 2001 11:46:39 -0700


4 of the leaks come from MemberCommand/SimpleMemberCommand:

They have there own implemenation of New().
It is almost identical to the one defined in itkNewMacro
except for the part which UnRegister the rawPtr.

I replaced New() by itkNewMacro - this fixes the leak.

Please let me know if this has other undesirable
effects.

----------------------------------------------------
One of the leak is from line 131 of the BasicArchitectureTest:
itk::OutputWindow::SetInstance(new TextOutput);

This has been fixed by using New instead of new.
-----------------------------------------------------

The UMR's are definitely a Microsoft problem!
I get them also with the following simple program:

template <class T>
class MyClass
{
 public:
  static Test()
  {
    std::cout << typeid(T).name() << std::endl;
    
  }
};

int main()
{
  MyClass<unsigned char>::Test();

  return 0;
}


Lydia

> -----Original Message-----
> From: Bill Hoffman [mailto:bill.hoffman@kitware.com]
> Sent: Thursday, July 19, 2001 4:22 AM
> To: lng@insightful.com; Insight-developers (E-mail)
> Subject: Re: [Insight-developers] purify errors on VC++
> 
> 
> The umr's are from the use of typeid and rtti as far as I can tell.
> I think that is a Microsoft bug.   I am not sure about the leaks.
> I think that the SGI purify may not be working...
> 
> -Bill
> 
> 
> At 08:38 PM 7/18/01 -0700, Lydia Ng wrote:
> >Hi All,
> >
> >I just installed purify for the PC and ran it on the
> >itkBasicArchitectureTest.
> >I get whole bunch of "Uninitialized memory read in DName::DName"
> >errors - each time something is created using the ObjectFactory.
> >(see an example below)
> >
> >Is this an ITK problem or VC++ problem?
> >
> >Also there are 5 memory leaks (see log below)
> >
> >GE people: do you these purify errors show on the other
> >test platforms?
> >
> >Lydia
> >
> >
> >-----------------------------------------------------
> >
> >[W] UMR: Uninitialized memory read in DName::DName(void) {1 
> occurrence}
> >     Reading 4 bytes from 0x00e6fb30 (4 bytes at 0x00e6fb30 
> uninitialized)
> >     Address 0x00e6fb30 points into a thread's stack
> >     Thread ID: 0x4d8
> >     Error location
> >         DName::DName(void) [MSVCRTD.dll]
> >         UnDecorator::getECSUDataType(void) [MSVCRTD.dll]
> >         UnDecorator::getBasicDataType(DName const&) [MSVCRTD.dll]
> >         UnDecorator::getPrimaryDataType(DName const&) [MSVCRTD.dll]
> >         UnDecorator::getDataType(DName *) [MSVCRTD.dll]
> >         UnDecorator::getDecoratedName(void) [MSVCRTD.dll]
> >         UnDecorator::operator char *(void) [MSVCRTD.dll]
> >         _unDName       [MSVCRTD.dll]
> >         type_info::name(void)const [typname.obj]
> >         
> itk::ObjectFactory<MemberCommand<AllEvents>::itk>::Create(void)
> >[itkObjectFactory.h:71]
> >                 public:
> >                   static T::Pointer Create()
> >                   {
> >              =>     LightObject::Pointer ret =
> >ObjectFactory::CreateInstance(typeid(T).name());
> >                     return dynamic_cast<T*>(ret.GetPointer());
> >                   }
> >                 };
> >
> >--------------------------------
> >[W] MLK: Memory leak of 24 bytes from 1 block allocated in
> >itk::LightObject::new(UINT)
> >     Distribution of leaked blocks
> >     Allocation location
> >         new(UINT)      [new.cpp:23]
> >         itk::LightObject::new(UINT) [itkLightObject.cxx:225]
> >         main           [itkBasicArchitectureTest.cxx:132]
> >         mainCRTStartup [crtexe.c:338]
> >[W] MLK: Memory leak of 20 bytes from 1 block allocated in
> >itk::LightObject::new(UINT)
> >     Distribution of leaked blocks
> >     Allocation location
> >         new(UINT)      [new.cpp:23]
> >         itk::LightObject::new(UINT) [itkLightObject.cxx:225]
> >         itk::SimpleMemberCommand<ShowProgressObject>::New(void)
> >[itkCommand.h:281]
> >         main           [itkBasicArchitectureTest.cxx:176]
> >         mainCRTStartup [crtexe.c:338]
> >[W] MLK: Memory leak of 20 bytes from 1 block allocated in
> >itk::LightObject::new(UINT)
> >     Distribution of leaked blocks
> >     Allocation location
> >         new(UINT)      [new.cpp:23]
> >         itk::LightObject::new(UINT) [itkLightObject.cxx:225]
> >         itk::SimpleMemberCommand<StartEndEvent>::New(void)
> >[itkCommand.h:281]
> >         main           [itkBasicArchitectureTest.cxx:184]
> >         mainCRTStartup [crtexe.c:338]
> >[W] MLK: Memory leak of 20 bytes from 1 block allocated in
> >itk::LightObject::new(UINT)
> >     Distribution of leaked blocks
> >     Allocation location
> >         new(UINT)      [new.cpp:23]
> >         itk::LightObject::new(UINT) [itkLightObject.cxx:225]
> >         itk::SimpleMemberCommand<StartEndEvent>::New(void)
> >[itkCommand.h:281]
> >         main           [itkBasicArchitectureTest.cxx:190]
> >         mainCRTStartup [crtexe.c:338]
> >[W] MLK: Memory leak of 24 bytes from 1 block allocated in
> >itk::LightObject::new(UINT)
> >     Distribution of leaked blocks
> >     Allocation location
> >         new(UINT)      [new.cpp:23]
> >         itk::LightObject::new(UINT) [itkLightObject.cxx:225]
> >         itk::MemberCommand<AllEvents>::New(void) [itkCommand.h:193]
> >         main           [itkBasicArchitectureTest.cxx:197]
> >         mainCRTStartup [crtexe.c:338]
> >
> >
> >_______________________________________________
> >Insight-developers mailing list
> >Insight-developers@public.kitware.com
> >http://public.kitware.com/mailman/listinfo/insight-developers