[Insight-users] crashes N-D Linear Time Exact Signed Euclidean Distance Transform

Oleksandr Dzyubak adzyubak at gmail.com
Fri May 30 10:01:11 EDT 2008


Hi Bill,

I also was thinking of rebuilding ITK in the debug mode.
So last night I found a box and did that.
After running the valgrind on an executable, I got the lines causing 
failure (from up to bottom).

Actually, the program that causes failure is 
"SignedMaurerDistanceMapImageFilterTest.cxx"
and in particular line 23 (   reader->Update();  actually generated by 
(itkImageFileReader.txx:153) )
and line 38  ( writer->Update(); generated by 
(itkImageFileWriter.txx:232) ). See log below.

What could cause such a failure?

Alex

********* Debug error log *******

dzyubak at debian: /Images$ valgrind 
./SignedMaurerDistanceMapImageFilterTest SquareBinary201.hdr test.hdr

==5109== Invalid write of size 8
==5109==    at 0x40AE720: itk::AnalyzeImageIO::ReadImageInformation() 
(in /usr/lib/libITKIO.so.3.4.0)
==5109==    by 0x80C0D14: itk::ImageFileReader<itk::Image<int, 2>, 
itk::DefaultConvertPixelTraits<int> >::GenerateOutputInformation() 
(itkImageFileReader.txx:153)
==5109==    by 0x44E9A05: itk::ProcessObject::UpdateOutputInformation() 
(in /usr/lib/libITKCommon.so.3.4.0)
==5109==    by 0x80C132B: itk::ImageBase<2>::UpdateOutputInformation() 
(itkImageBase.txx:177)
==5109==    by 0x44A9991: itk::DataObject::Update() (in 
/usr/lib/libITKCommon.so.3.4.0)
==5109==    by 0x44E9AB5: itk::ProcessObject::Update() (in 
/usr/lib/libITKCommon.so.3.4.0)
==5109==    by 0x808C088: main 
(SignedMaurerDistanceMapImageFilterTest.cxx:23)
==5109==  Address 0x4f4f340 is 0 bytes after a block of size 16 alloc'd
==5109==    at 0x4023294: operator new(unsigned) (vg_replace_malloc.c:224)
==5109==    by 0x40AE5BE: itk::AnalyzeImageIO::ReadImageInformation() 
(in /usr/lib/libITKIO.so.3.4.0)
==5109==    by 0x80C0D14: itk::ImageFileReader<itk::Image<int, 2>, 
itk::DefaultConvertPixelTraits<int> >::GenerateOutputInformation() 
(itkImageFileReader.txx:153)
==5109==    by 0x44E9A05: itk::ProcessObject::UpdateOutputInformation() 
(in /usr/lib/libITKCommon.so.3.4.0)
==5109==    by 0x80C132B: itk::ImageBase<2>::UpdateOutputInformation() 
(itkImageBase.txx:177)
==5109==    by 0x44A9991: itk::DataObject::Update() (in 
/usr/lib/libITKCommon.so.3.4.0)
==5109==    by 0x44E9AB5: itk::ProcessObject::Update() (in 
/usr/lib/libITKCommon.so.3.4.0)
==5109==    by 0x808C088: main 
(SignedMaurerDistanceMapImageFilterTest.cxx:23)
==5109==
==5109== Invalid write of size 8
==5109==    at 0x40AE740: itk::AnalyzeImageIO::ReadImageInformation() 
(in /usr/lib/libITKIO.so.3.4.0)
==5109==    by 0x80C0D14: itk::ImageFileReader<itk::Image<int, 2>, 
itk::DefaultConvertPixelTraits<int> >::GenerateOutputInformation() 
(itkImageFileReader.txx:153)
==5109==    by 0x44E9A05: itk::ProcessObject::UpdateOutputInformation() 
(in /usr/lib/libITKCommon.so.3.4.0)
==5109==    by 0x80C132B: itk::ImageBase<2>::UpdateOutputInformation() 
(itkImageBase.txx:177)
==5109==    by 0x44A9991: itk::DataObject::Update() (in 
/usr/lib/libITKCommon.so.3.4.0)
==5109==    by 0x44E9AB5: itk::ProcessObject::Update() (in 
/usr/lib/libITKCommon.so.3.4.0)
==5109==    by 0x808C088: main 
(SignedMaurerDistanceMapImageFilterTest.cxx:23)
==5109==  Address 0x4f4f380 is 0 bytes after a block of size 16 alloc'd
==5109==    at 0x4023294: operator new(unsigned) (vg_replace_malloc.c:224)
==5109==    by 0x40AE638: itk::AnalyzeImageIO::ReadImageInformation() 
(in /usr/lib/libITKIO.so.3.4.0)
==5109==    by 0x80C0D14: itk::ImageFileReader<itk::Image<int, 2>, 
itk::DefaultConvertPixelTraits<int> >::GenerateOutputInformation() 
(itkImageFileReader.txx:153)
==5109==    by 0x44E9A05: itk::ProcessObject::UpdateOutputInformation() 
(in /usr/lib/libITKCommon.so.3.4.0)
==5109==    by 0x80C132B: itk::ImageBase<2>::UpdateOutputInformation() 
(itkImageBase.txx:177)
==5109==    by 0x44A9991: itk::DataObject::Update() (in 
/usr/lib/libITKCommon.so.3.4.0)
==5109==    by 0x44E9AB5: itk::ProcessObject::Update() (in 
/usr/lib/libITKCommon.so.3.4.0)
==5109==    by 0x808C088: main 
(SignedMaurerDistanceMapImageFilterTest.cxx:23)
==5109==
==5109== Invalid write of size 8
==5109==    at 0x40AE75A: itk::AnalyzeImageIO::ReadImageInformation() 
(in /usr/lib/libITKIO.so.3.4.0)
==5109==    by 0x80C0D14: itk::ImageFileReader<itk::Image<int, 2>, 
itk::DefaultConvertPixelTraits<int> >::GenerateOutputInformation() 
(itkImageFileReader.txx:153)
==5109==    by 0x44E9A05: itk::ProcessObject::UpdateOutputInformation() 
(in /usr/lib/libITKCommon.so.3.4.0)
==5109==    by 0x80C132B: itk::ImageBase<2>::UpdateOutputInformation() 
(itkImageBase.txx:177)
==5109==    by 0x44A9991: itk::DataObject::Update() (in 
/usr/lib/libITKCommon.so.3.4.0)
==5109==    by 0x44E9AB5: itk::ProcessObject::Update() (in 
/usr/lib/libITKCommon.so.3.4.0)
==5109==    by 0x808C088: main 
(SignedMaurerDistanceMapImageFilterTest.cxx:23)
==5109==  Address 0x4f4f3c0 is 0 bytes after a block of size 16 alloc'd
==5109==    at 0x4023294: operator new(unsigned) (vg_replace_malloc.c:224)
==5109==    by 0x40AE6B2: itk::AnalyzeImageIO::ReadImageInformation() 
(in /usr/lib/libITKIO.so.3.4.0)
==5109==    by 0x80C0D14: itk::ImageFileReader<itk::Image<int, 2>, 
itk::DefaultConvertPixelTraits<int> >::GenerateOutputInformation() 
(itkImageFileReader.txx:153)
==5109==    by 0x44E9A05: itk::ProcessObject::UpdateOutputInformation() 
(in /usr/lib/libITKCommon.so.3.4.0)
==5109==    by 0x80C132B: itk::ImageBase<2>::UpdateOutputInformation() 
(itkImageBase.txx:177)
==5109==    by 0x44A9991: itk::DataObject::Update() (in 
/usr/lib/libITKCommon.so.3.4.0)
==5109==    by 0x44E9AB5: itk::ProcessObject::Update() (in 
/usr/lib/libITKCommon.so.3.4.0)
==5109==    by 0x808C088: main 
(SignedMaurerDistanceMapImageFilterTest.cxx:23)
==5109==
==5109== Invalid read of size 8
==5109==    at 0x409D27E: 
itk::NiftiImageIO::SetNIfTIOrientationFromImageIO(int, int) (in 
/usr/lib/libITKIO.so.3.4.0)
==5109==    by 0x409E65E: itk::NiftiImageIO::WriteImageInformation() (in 
/usr/lib/libITKIO.so.3.4.0)
==5109==    by 0x409C1C1: itk::NiftiImageIO::Write(void const*) (in 
/usr/lib/libITKIO.so.3.4.0)
==5109==    by 0x80CBB00: itk::ImageFileWriter<itk::Image<double, 2> 
 >::GenerateData() (itkImageFileWriter.txx:279)
==5109==    by 0x80D0F99: itk::ImageFileWriter<itk::Image<double, 2> 
 >::Write() (itkImageFileWriter.txx:232)
==5109==    by 0x808C79D: itk::ImageFileWriter<itk::Image<double, 2> 
 >::Update() (itkImageFileWriter.h:148)
==5109==    by 0x808C1D2: main 
(SignedMaurerDistanceMapImageFilterTest.cxx:38)
==5109==  Address 0x5241e50 is 0 bytes after a block of size 16 alloc'd
==5109==    at 0x4023294: operator new(unsigned) (vg_replace_malloc.c:224)
==5109==    by 0x409D150: 
itk::NiftiImageIO::SetNIfTIOrientationFromImageIO(int, int) (in 
/usr/lib/libITKIO.so.3.4.0)
==5109==    by 0x409E65E: itk::NiftiImageIO::WriteImageInformation() (in 
/usr/lib/libITKIO.so.3.4.0)
==5109==    by 0x409C1C1: itk::NiftiImageIO::Write(void const*) (in 
/usr/lib/libITKIO.so.3.4.0)
==5109==    by 0x80CBB00: itk::ImageFileWriter<itk::Image<double, 2> 
 >::GenerateData() (itkImageFileWriter.txx:279)
==5109==    by 0x80D0F99: itk::ImageFileWriter<itk::Image<double, 2> 
 >::Write() (itkImageFileWriter.txx:232)
==5109==    by 0x808C79D: itk::ImageFileWriter<itk::Image<double, 2> 
 >::Update() (itkImageFileWriter.h:148)
==5109==    by 0x808C1D2: main 
(SignedMaurerDistanceMapImageFilterTest.cxx:38)
==5109==
==5109== Invalid read of size 8
==5109==    at 0x409D292: 
itk::NiftiImageIO::SetNIfTIOrientationFromImageIO(int, int) (in 
/usr/lib/libITKIO.so.3.4.0)
==5109==    by 0x409E65E: itk::NiftiImageIO::WriteImageInformation() (in 
/usr/lib/libITKIO.so.3.4.0)
==5109==    by 0x409C1C1: itk::NiftiImageIO::Write(void const*) (in 
/usr/lib/libITKIO.so.3.4.0)
==5109==    by 0x80CBB00: itk::ImageFileWriter<itk::Image<double, 2> 
 >::GenerateData() (itkImageFileWriter.txx:279)
==5109==    by 0x80D0F99: itk::ImageFileWriter<itk::Image<double, 2> 
 >::Write() (itkImageFileWriter.txx:232)
==5109==    by 0x808C79D: itk::ImageFileWriter<itk::Image<double, 2> 
 >::Update() (itkImageFileWriter.h:148)
==5109==    by 0x808C1D2: main 
(SignedMaurerDistanceMapImageFilterTest.cxx:38)
==5109==  Address 0x5241cd0 is 0 bytes after a block of size 16 alloc'd
==5109==    at 0x4023294: operator new(unsigned) (vg_replace_malloc.c:224)
==5109==    by 0x409D03D: 
itk::NiftiImageIO::SetNIfTIOrientationFromImageIO(int, int) (in 
/usr/lib/libITKIO.so.3.4.0)
==5109==    by 0x409E65E: itk::NiftiImageIO::WriteImageInformation() (in 
/usr/lib/libITKIO.so.3.4.0)
==5109==    by 0x409C1C1: itk::NiftiImageIO::Write(void const*) (in 
/usr/lib/libITKIO.so.3.4.0)
==5109==    by 0x80CBB00: itk::ImageFileWriter<itk::Image<double, 2> 
 >::GenerateData() (itkImageFileWriter.txx:279)
==5109==    by 0x80D0F99: itk::ImageFileWriter<itk::Image<double, 2> 
 >::Write() (itkImageFileWriter.txx:232)
==5109==    by 0x808C79D: itk::ImageFileWriter<itk::Image<double, 2> 
 >::Update() (itkImageFileWriter.h:148)
==5109==    by 0x808C1D2: main 
(SignedMaurerDistanceMapImageFilterTest.cxx:38)
==5109==
==5109== Invalid read of size 8
==5109==    at 0x409D2A6: 
itk::NiftiImageIO::SetNIfTIOrientationFromImageIO(int, int) (in 
/usr/lib/libITKIO.so.3.4.0)
==5109==    by 0x409E65E: itk::NiftiImageIO::WriteImageInformation() (in 
/usr/lib/libITKIO.so.3.4.0)
==5109==    by 0x409C1C1: itk::NiftiImageIO::Write(void const*) (in 
/usr/lib/libITKIO.so.3.4.0)
==5109==    by 0x80CBB00: itk::ImageFileWriter<itk::Image<double, 2> 
 >::GenerateData() (itkImageFileWriter.txx:279)
==5109==    by 0x80D0F99: itk::ImageFileWriter<itk::Image<double, 2> 
 >::Write() (itkImageFileWriter.txx:232)
==5109==    by 0x808C79D: itk::ImageFileWriter<itk::Image<double, 2> 
 >::Update() (itkImageFileWriter.h:148)
==5109==    by 0x808C1D2: main 
(SignedMaurerDistanceMapImageFilterTest.cxx:38)
==5109==  Address 0x5241b50 is 0 bytes after a block of size 16 alloc'd
==5109==    at 0x4023294: operator new(unsigned) (vg_replace_malloc.c:224)
==5109==    by 0x409CF30: 
itk::NiftiImageIO::SetNIfTIOrientationFromImageIO(int, int) (in 
/usr/lib/libITKIO.so.3.4.0)
==5109==    by 0x409E65E: itk::NiftiImageIO::WriteImageInformation() (in 
/usr/lib/libITKIO.so.3.4.0)
==5109==    by 0x409C1C1: itk::NiftiImageIO::Write(void const*) (in 
/usr/lib/libITKIO.so.3.4.0)
==5109==    by 0x80CBB00: itk::ImageFileWriter<itk::Image<double, 2> 
 >::GenerateData() (itkImageFileWriter.txx:279)
==5109==    by 0x80D0F99: itk::ImageFileWriter<itk::Image<double, 2> 
 >::Write() (itkImageFileWriter.txx:232)
==5109==    by 0x808C79D: itk::ImageFileWriter<itk::Image<double, 2> 
 >::Update() (itkImageFileWriter.h:148)
==5109==    by 0x808C1D2: main 
(SignedMaurerDistanceMapImageFilterTest.cxx:38)
==5109==
==5109== ERROR SUMMARY: 6 errors from 6 contexts (suppressed: 71 from 1)
==5109== malloc/free: in use at exit: 0 bytes in 0 blocks.
==5109== malloc/free: 16,858 allocs, 16,858 frees, 3,500,876 bytes 
allocated.
==5109== For counts of detected errors, rerun with: -v
==5109== All heap blocks were freed -- no leaks are possible.

************ End of log ******

Bill Lorensen wrote:
> Oleksandr,
>
> That's not a good error and may explain your problem. An invalid write
> means that it is trying to write to memory that is not allocated.
>
> You must be building release. If you build debug, valgrind will give
> the exact offending line.
>
> Bill
>
> On Thu, May 29, 2008 at 5:42 PM, Oleksandr Dzyubak <adzyubak at gmail.com> wrote:
>   
>> Hi Bill,
>>
>> I ran valgrind on my box.
>>
>> dzyubak at debian: /Images$ valgrind --tool=memcheck
>> ./SignedMaurerDistanceMapImageFilterTest SquareBinary201.hdr test.hdr
>>
>> I got several interesting results.
>>
>> 1) Running valgrind on an executable results in producing output image which
>> matches that
>> in the archive. This never happens if I just run an executable since a
>> program aborts right away.
>>
>> 2) Valgrind produces a huge log with errors. In the end it says:
>>
>> ==15656== ERROR SUMMARY: 29 errors from 7 contexts (suppressed: 69 from 1).
>>
>> 3) And it starts its log with as below.
>>
>> ==15656== Invalid write of size 8
>> ==15656==    at 0x40DF148: itk::AnalyzeImageIO::ReadImageInformation() (in
>> /usr/local/lib/InsightToolkit/libITKIO.so.3.7.0)
>> ==15656==    by 0x80C66A6: itk::ImageFileReader<itk::Image<int, 2>,
>> itk::DefaultConvertPixelTraits<int> >::GenerateOutputInformation() (in
>> /home/dzyubak/Test/N-D_Linear_Time_Exact_Signed_Euclidean_Distance_Transform/Images/SignedMaurerDistanceMapImageFilterTest)
>>
>>
>> Is this memory block size mismatch coming from type traits or what?
>> Any ideas how to treat that?
>>
>> Thanks,
>> Alex
>>
>>
>> Bill Lorensen wrote:
>>     
>>> Oleksandr,
>>>
>>> If you have valgrind on your linux box, try running it. It can find
>>> some tricky memory problems.
>>>
>>> Bill
>>>       
>>     



More information about the Insight-users mailing list