[Insight-users] itk::ObjectFactoryBase::RegisterFactory under win32

Luis Ibanez luis.ibanez at kitware.com
Fri Jun 25 15:50:51 EDT 2010


Hi Neil,

Is the RegisterFactory() line being called from
code in a DLL library  ?


    Please let us know,


          Thanks


               Luis


--------------------------------------------------------------
On Fri, Jun 25, 2010 at 2:14 AM, <Neil.Burdett at csiro.au> wrote:

>  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
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100625/c79800e3/attachment.htm>


More information about the Insight-users mailing list