Hvae you tried to replace:<br>PreviewFilterCurvatureType *p = PreviewFilterCurvatureType::<div class="im">New();<br><br>with<br><br>PreviewFilterCurvatureType::Pointer p = PreviewFilterCurvatureType::<div class="im">New();</div>
<br></div><br><br><div class="gmail_quote">On Tue, Oct 18, 2011 at 9:14 AM, Christian Lackas <span dir="ltr">&lt;<a href="mailto:lackas@invicro.com">lackas@invicro.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
* Sean McBride &lt;<a href="mailto:sean@rogue-research.com">sean@rogue-research.com</a>&gt; [111014 23:46]:<br>
<br>
Hi Sean, Everybody,<br>
<div class="im"><br>
&gt; If you&#39;re dying in free() it&#39;s probably because of a memory error.<br>
&gt; You could try enabling MallocScribble and friends (see &#39;man malloc&#39;)<br>
&gt; and/or guard malloc (see &#39;man libgmalloc&#39;).<br>
<br>
</div>thanks for your suggestions. They gave me a few more ideas on how to<br>
look at the problem.<br>
<div class="im"><br>
&gt; Does it work if you build in 10.6 and run that executable in 10.7?  If<br>
&gt; so, it could be related to SDK and deployment target choice.<br>
<br>
</div>It does not matter where it is build.<br>
However, thanks to MallocScribble, I now also get it to crash on Snow<br>
Leopard (which makes development much easier for me, since I have not<br>
upgraded yet).<br>
<div class="im"><br>
&gt; Is there nothing in the console?  Failures in malloc/free often log something.<br>
<br>
</div>Nothing on the console.<br>
<br>
When trying to understand the source of memory issue, I reduced the<br>
example to a minimum, basically just a main() with a call like this:<br>
<div class="im"><br>
    PreviewFilterCurvatureType *p = PreviewFilterCurvatureType::New();<br>
<br>
</div>An complete project is available here (just set ITK_DIR env variable to<br>
your ITK build directory):<br>
<br>
    <a href="http://www.invicro.com/vtk/itkcrash.tgz" target="_blank">http://www.invicro.com/vtk/itkcrash.tgz</a><br>
<br>
If I do (see run.sh):<br>
<br>
    qmake &amp;&amp; make clean &amp;&amp; make &amp;&amp; MallocScribble=1 ./crash.app/Contents/MacOS/crash<br>
<br>
I get this crash:<br>
<br>
    #0  0x000000010000afb6 in itk::SmartPointer&lt;itk::CurvatureFlowFunction&lt;itk::Image&lt;float, 2u&gt; &gt; &gt;::Register (this=0x7fff5fbff040) at itkSmartPointer.h:142<br>
    #1  0x000000010000b004 in itk::SmartPointer&lt;itk::CurvatureFlowFunction&lt;itk::Image&lt;float, 2u&gt; &gt; &gt;::operator= (this=0x7fff5fbff040, r=0x101510a80) at itkSmartPointer.h:122<br>
    #2  0x000000010000b04b in itk::SmartPointer&lt;itk::CurvatureFlowFunction&lt;itk::Image&lt;float, 2u&gt; &gt; &gt;::operator= (this=0x7fff5fbff040, r=@0x7fff5fbff050) at itkSmartPointer.h:113<br>
    #3  0x000000010002114a in itk::CurvatureFlowImageFilter&lt;itk::Image&lt;float, 2u&gt;, itk::Image&lt;float, 2u&gt; &gt;::CurvatureFlowImageFilter (this=0x101510540) at itkCurvatureFlowImageFilter.txx:38<br>
    #4  0x0000000100021208 in itk::CurvatureFlowImageFilter&lt;itk::Image&lt;float, 2u&gt;, itk::Image&lt;float, 2u&gt; &gt;::New () at itkCurvatureFlowImageFilter.h:100 #5  0x000000010000aa20 in main (argc=1, argv=0x7fff5fbff158) at crash.cxx:15<br>

<br>
Attached below is the output for the LightObject on which it tries to call<br>
Register(), which seems to be uninitialized.<br>
<br>
Interestingly, it only crashed when using qmake, not when building a<br>
similar cmake build script. In the end I found that the problem was a<br>
<br>
    export MACOSX_DEPLOYMENT_TARGET = 10.4<br>
<br>
in the qmake produced makefile, and setting this to 10.5 fixed it for<br>
the small example.<br>
Can anybody please tell me why it crashes with the 10.4 setting? I was<br>
not able to figure that part out. I could not figure out how to use<br>
malloc_history(1), yet.<br>
<br>
Unfortunately, our main application still crashes in the<br>
PreviewFilterCurvatureType::New(), even with the 10.5 setting, and since<br>
I believe this is related (although not exactly the same) as the minimal<br>
example above, I wonder if anybody can give me another pointer on how to<br>
debug this.<br>
<br>
Sean, could you please try the minimal example and give me a hint on how<br>
I would debug the actual cause of the problem there?<br>
<br>
Is this a compiler issue? An ITK issue? Or what else?<br>
<br>
Thanks,<br>
 Christian<br>
<br>
<br>
(gdb) p *m_Pointer<br>
$2 = {<br>
  &lt;itk::FiniteDifferenceFunction&lt;itk::Image&lt;float, 2u&gt; &gt;&gt; = {<br>
    &lt;itk::LightObject&gt; = {<br>
      _vptr$LightObject = 0x5555555555555555,<br>
      m_ReferenceCount = 1431655765,<br>
      m_ReferenceCountLock = {<br>
        m_FastMutexLock = {<br>
          __sig = 6148914691236517205,<br>
          __opaque = &#39;U&#39; &lt;repeats 56 times&gt;<br>
        }<br>
      }<br>
    },<br>
    members of itk::FiniteDifferenceFunction&lt;itk::Image&lt;float, 2u&gt; &gt;:<br>
    m_Radius = {<br>
      m_Size = {6148914691236517205, 6148914691236517205}<br>
    },<br>
    m_ScaleCoefficients = {1.1945305291614955e+103, 1.1945305291614955e+103}<br>
  },<br>
  members of itk::CurvatureFlowFunction&lt;itk::Image&lt;float, 2u&gt; &gt;:<br>
  m_TimeStep = 1.1945305291614955e+103<br>
<div class="im">}<br>
<br>
<br>
--<br>
Dr. Christian Lackas, Managing Partner<br>
inviCRO, LLC -- In Imaging Yours<br>
P: <a href="tel:%2B1%20617%20933%208733" value="+16179338733">+1 617 933 8733</a>, F: <a href="tel:%2B49%202203%209034722" value="+4922039034722">+49 2203 9034722</a>, E: <a href="mailto:lackas@invicro.com">lackas@invicro.com</a><br>

<a href="http://www.invicro.com/" target="_blank">http://www.invicro.com/</a>  <a href="http://www.spect-ct.com/" target="_blank">http://www.spect-ct.com/</a><br>
</div><div><div></div><div class="h5">_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</div></div></blockquote></div><br>