[Insight-developers] Memory exception
ivan gm
ivan.gm.itk at gmail.com
Mon Dec 1 04:49:29 EST 2008
Hi,
Unfortunately, neither of this option caught the excetion, I think this is
happening because the itk pipeline is running under a thread. When the
program crash Visual Studio shows the afxtls_.h file in the line 197 (Create
object funtion). I only get this exception when I use a image of 300 slices.
if I use a normal 40 slices-image it runs nice. But my question is, if I
increase the RAM or the virtual memory it would solve the problem?
Thanks a lot.
On Tue, Nov 25, 2008 at 1:32 PM, Tom Vercauteren <tom.vercauteren at m4x.org>wrote:
> Hi Ivan,
>
> You might also want to try catching other types of exceptions. I
> remember that ITK writers can also throw a std::bad_alloc exception. I
> guess that other types are also possible...
>
> Try this:
> try{
> writer->Update();
> }
> catch( itk::ExceptionObject & excp ) {
> std::cerr << "itk::ExceptionObject: " << excp << std::endl;
> }
> catch ( std::bad_alloc & excp ){
> std::cerr << "std::bad_alloc: " << excp.what() << std::endl;
> }
> catch ( std::exception & excp ){
> std::cerr << "std::exception: " << excp.what() << std::endl;
> }
>
> Tom
>
> On Tue, Nov 25, 2008 at 12:52 PM, ivan gm <ivan.gm.itk at gmail.com> wrote:
> > Hello:
> >
> > Even with this clause I can't caught the exception. It's very extrange
> > because if I use the AnalyzeImageIO it works perfectly and with the
> > GDCMImageIO it fails. In order to give you more information I attach the
> > stack trace given by dotnet:
> >
> > kernel32.dll!7c812aeb()
> > [Los marcos siguientes pueden no ser correctos o faltar, no se han
> > cargado símbolos para kernel32.dll]
> > kernel32.dll!7c812aeb()
> >> mfc80d.dll!CThreadLocal<AFX_MODULE_THREAD_STATE>::CreateObject()
> Línea
> >> 198 + 0x47 bytes C++
> > msvcr80d.dll!_CxxThrowException(void * pExceptionObject=0x0ffbd598,
> > const _s__ThrowInfo * pThrowInfo=0x783c0b6c) Línea 166 C++
> > mfc80d.dll!AfxThrowMemoryException() Línea 222 C++
> > mfc80d.dll!AfxNewHandler(unsigned int __formal=180355072) Línea 304
> > C++
> > mfc80d.dll!operator new(unsigned int nSize=180355072) Línea 360 +
> 0xd
> > bytes C++
> > mfc80d.dll!operator new[](unsigned int nSize=180355072) Línea 382 +
> > 0x9 bytes C++
> > myAplication.exe!itk::GDCMImageIO::Write(const void *
> > buffer=0x1fb40040) Línea 1069 + 0xc bytes C++
> > myAplication.exe!itk::ImageFileWriter<itk::OrientedImage<short,3>
> >>::GenerateData() Línea 279 + 0x33 bytes C++
> > myAplication.exe!itk::ImageFileWriter<itk::OrientedImage<short,3>
> >>::Write() Línea 232 + 0x12 bytes C++
> > myAplication.exe!itk::ImageFileWriter<itk::OrientedImage<short,3>
> >>::Update() Línea 148 + 0x12 bytes C++
> > myAplication.exe!CmyAplicationDlg::FilterThread() Línea 608 + 0x32
> > bytes C++
> >
> > Thanks for your help.
> >
> >
> >
> > On Mon, Nov 24, 2008 at 1:25 PM, Dan Mueller <dan.muel at gmail.com> wrote:
> >>
> >> Hi Ivan,
> >>
> >> Perhaps try the following:
> >>
> >> try
> >> {
> >> writer->Update();
> >> }
> >> catch( itk::ExceptionObject & excp )
> >> {
> >> std::cerr << excp << std::endl;
> >> }
> >>
> >> This should provide some more details regarding this issue. Let us
> >> know what you find.
> >>
> >> HTH
> >>
> >> Regards, Dan
> >>
> >> 2008/11/24 ivan gm <ivan.gm.itk at gmail.com>:
> >> > Hello:
> >> >
> >> > Im trying to save an image in a file with the code bellow:
> >> > writer = WriterType::New();
> >> > writer->SetFileName(originalName.c_str());
> >> > writer->SetImageIO( itk:DicomImageIO::New() );
> >> > // itk::AnalyzeImageIO::New());
> >> > writer->SetInput( this->tempImage1 );
> >> > writer->Update();
> >> > When i use a itk::AnalyzeImageIO it works fine but when I change it to
> >> > DicomImageIO (because i want to save the file in dcm format instead of
> >> > hdr)
> >> > the program crash with the following Excetion message:
> >> >
> >> > Excepción no controlada en 0x7c812aeb en myprogram.exe: Excepción de
> >> > Microsoft C++: CMemoryException en la ubicación de memoria 0x0ffbd514.
> >> >
> >> > I think the problem is that my computer don't have enough RAM
> memory...
> >> > can
> >> > anybody tell me if I can't solve the problem without increasing the
> RAM?
> >> >
> >> > On the other hand, I tried to handle this CMemoryException with the
> >> > following code:
> >> > try {
> >> > //code
> >> > } catch (CMemoryException e) {
> >> > printf("whatever");
> >> > }
> >> > But it doesn't catch anything. Any help?
> >> >
> >> >
> >> > Thanks a lot.
> >> >
> >> > Iván García Martínez.
> >> >
> >> > _______________________________________________
> >> > Insight-developers mailing list
> >> > Insight-developers at itk.org
> >> > http://www.itk.org/mailman/listinfo/insight-developers
> >
> >
> > _______________________________________________
> > Insight-developers mailing list
> > Insight-developers at itk.org
> > http://www.itk.org/mailman/listinfo/insight-developers
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20081201/1f221b42/attachment.htm>
More information about the Insight-developers
mailing list