[Insight-users] Resampling 64-bit crash

Florian Pierron F.Pierron at exeter.ac.uk
Wed Feb 14 09:05:34 EST 2007


Dear ITK users and developers,

We need to resample big data and we decided to port our application in 
64-bit version. We're currently working on Windows Server 2003, 
Enterprise x64 Edition, Dual Core AMD Opteron and using ITK-3-0 branch 
with VC2005. Unfortunately our application crashes when trying to 
resample big data.

We reproduced the crash with the ResampleImageFilter example 
(D:\InsightToolkit-3.0.0\Examples\Filtering\ResampleImageFilter.cxx) by 
changing the size of the output image to be more than 3-4 GB:
Line 279:    size[0] = 5 * 1000 * 1000;  // number of pixels along X
Line 280:    size[1] = 1 * 1000;  // number of pixels along Y

We run this example by setting the working directory to 
"D:\InsightToolkit-3.0.0\Testing\Data\Input" and the command line 
arguments to
"BrainSliceBinary.png BrainSliceBinaryOutput.png 0" (a random image I 
found in the ITK folder).

1) If I run this example with the modified size above (5 GB), it crashes 
immediately in:

  /** Set the pixel. */
  inline void Set(TType & output, const TType & input) const
    {output = input;}

with this call stack:

     ResampleImageFilter.exe!itk::DefaultPixelAccessor<unsigned 
char>::Set(unsigned char & output=, const unsigned char & input=0)  Line 
67 + 0x1d bytes
     
ResampleImageFilter.exe!itk::DefaultPixelAccessorFunctor<itk::Image<unsigned 
char,2> >::Set(unsigned char & output=, const unsigned char & input=0)  
Line 77
     
ResampleImageFilter.exe!itk::ImageLinearIteratorWithIndex<itk::Image<unsigned 
char,2> >::Set(const unsigned char & value=0)  Line 106 + 0x47 bytes
     
ResampleImageFilter.exe!itk::ResampleImageFilter<itk::Image<unsigned 
char,2>,itk::Image<unsigned 
char,2>,double>::LinearThreadedGenerateData(const itk::ImageRegion<2> & 
outputRegionForThread={...}, int threadId=2)  Line 481
     
ResampleImageFilter.exe!itk::ResampleImageFilter<itk::Image<unsigned 
char,2>,itk::Image<unsigned char,2>,double>::ThreadedGenerateData(const 
itk::ImageRegion<2> & outputRegionForThread={...}, int threadId=2)  Line 192
     ResampleImageFilter.exe!itk::ImageSource<itk::Image<unsigned 
char,2> >::ThreaderCallback(void * arg=0x0000000002c2f4f8)  Line 282
     ResampleImageFilter.exe!itk::MultiThreader::SingleMethodProxy(void 
* arg=0x0000000002c2f4f8)  Line 748
     msvcr80d.dll!_callthreadstartex()  Line 348 + 0x17 bytes
     msvcr80d.dll!_threadstartex(void * ptd=0x0000000002c3c8f0)  Line 331


2) If I change the size to be 2GB, it's running fine. The limit between 
crashing and not crashing seems to be between 2 and 3 GB (with 8 threads).

3) If I force the SetNumberOfTheads to 1, it doesn't crash immediately 
(I think it crashes later, but it's quite slow so most of the time I 
killed it before). The funny thing is that when the number of threads is 
equal to 1:
- if the size is 4 GB, then 4 GB of memory is allocated immediately
- but if the size is 5 GB, only 700 MB is allocated
- for 7 GB, 2.65 GB is allocated
- for 10 GB, 1.4 GB is allocated (which is weirdly twice the 5GB)
I have no idea if this is meaningful at all, I was just wondering if 
there's a problem during memory allocation when the 4GB limit is reached...


Any ideas?

Cheers,
Florian



More information about the Insight-users mailing list