[Insight-users] itk::ObjectFactoryBase::RegisterFactory under win32
Neil.Burdett at csiro.au
Neil.Burdett at csiro.au
Fri Jun 25 02:14:14 EDT 2010
Hi,
I'm currently porting an application from Linux (Ubuntu) to Windows (Visual Studio 9 2008). The code works fine under Linux but the following line in Visual studio
itk::ObjectFactoryBase::RegisterFactory( itk::INRImageIOFactory::New() );
causes a memory leak (shown by the visual leak detector):
---------- Block 46358 at 0x04EBACB8: 92 bytes ----------
Call Stack:
f:\dd\vctools\crt_bld\self_x86\crt\src\dbgmalloc.c (56): malloc
f:\dd\vctools\crt_bld\self_x86\crt\src\newaop.cpp (7): operator new[]
c:\milxview-win32-depend\src-itk-3.16.0\code\common\itklightobject.cxx (102): itk::LightObject::operator new
c:\milx-view\lib\include\itk-ext\modules\io\itkinrimageiofactory.h (52): itk::INRImageIOFactory::New
c:\milx-view\testing\src\milxcte\milxemsfiltertest.cxx (75): main <--- This line
f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c (582): __tmainCRTStartup
f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c (399): mainCRTStartup
0x7C817077 (File and line number not available): RegisterWaitForInputIdle
Under windows do we have to delete this object? Because I see there is a win32 branch in the itklightobject.cxx i.e.
/**
* Avoid DLL boundary problems.
*/
#ifdef _WIN32
void*
LightObject
::operator new(size_t n)
{
return new char[n]; <--- This line corresponds to line 102 above
}
void*
LightObject
::operator new[](size_t n)
{
return new char[n];
}
void
LightObject
::operator delete(void* m)
{
delete [] (char*)m;
}
void
LightObject
::operator delete[](void* m, size_t)
{
delete [] (char*)m;
}
#endif
Any help most appreciated
Neil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100625/d8f94bfa/attachment-0001.htm>
More information about the Insight-users
mailing list