[Insight-users] ITK crash on Lion/Qt

Sean McBride sean at rogue-research.com
Tue Oct 18 11:35:45 EDT 2011


On Tue, 18 Oct 2011 15:14:10 +0200, Christian Lackas said:

>It does not matter where it is build. 
>However, thanks to MallocScribble, I now also get it to crash on Snow
>Leopard (which makes development much easier for me, since I have not
>upgraded yet).

BTW, I recommend always using MallocScribble in Debug, it only affects performance minimally, and makes bugs repro much more easily.

>Attached below is the output for the LightObject on which it tries to call
>Register(), which seems to be uninitialized.

You might also try valgrind, which is good at pinpointing such problems.  If you do, use 10.6, valgrind only barely supports 10.7, and only if built from svn trunk.  It's too slow to use always, but great for situations like this.

>Interestingly, it only crashed when using qmake, not when building a
>similar cmake build script. In the end I found that the problem was a
>
>    export MACOSX_DEPLOYMENT_TARGET = 10.4

Are you familiar with the 'deployment target' on Mac OS?  It's the oldest version of the OS you want to support at runtime.  If you don't care about about supporting older than, say, 10.6, you should set it to 10.6.

Parts of ITK are build differently based on the deployment taget.  Search the ITK codebase for " MAC_OS_X_VERSION_".

>(gdb) p *m_Pointer
>$2 = {
>  <itk::FiniteDifferenceFunction<itk::Image<float, 2u> >> = {
>    <itk::LightObject> = {
>      _vptr$LightObject = 0x5555555555555555, 

As the docs explain, when MallocScribble is set, all memory created with malloc/new is initialized to 0xAA and all freeed memory is set to 0x55.  So _vptr$LightObject has been freed.  Is the code you're running trying to use it after?

>      m_ReferenceCount = 1431655765, 
>      m_ReferenceCountLock = {
>        m_FastMutexLock = {
>          __sig = 6148914691236517205, 
>          __opaque = 'U' <repeats 56 times>

NB: ASCII 'U' is 0x55.  Could be all those other values are too.

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada




More information about the Insight-users mailing list