[vtkusers] [VTK 5.6.1] Unable to allocate ....

John Fraser John.Fraser at icr.ac.uk
Fri Oct 8 09:48:49 EDT 2010


I asked a similar question on error handling a while ago on this forum.  VTK does not support exception handling around Update as ITK does.  However I think the idea of handling an exception to Update is not really needed because in fact you shouldn't need to be calling Update in most cases anyway, i.e. it's up to the pipeline to determine when to call Update on each object as data is "pulled" through the pipe.  A better way is to check for pipeline errors by adding observers to each pipeline object and checking in the call back if an error has occurred (using AddObserver).  As an aside to this, are you also using the ReleaseDataFlag on each output like this, "imageReader.GetOutput().ReleaseDataFlagOn()", this will ensure that memory is released when not needed.

>>> Fireman Fireman <vtkusersneedhelp at yahoo.fr> 08/10/2010 12:19 >>>

Hi, 

I'm using the last VTK 5.6.1. 

I'm using a vtkDICOMImageReader to read DICOm images. I have got this error 

\vtk\common\vtkDataArrayTemplate.txx, line 140 
vtkShortArray (0931BF08): Unable to allocate 129499136 elements of size 2 
bytes. 

What's the problem? 

How can I catch this exception to  avoid the crash of my program  

I tried to do this but I could not cath  the exception :

//-----------------------------------------------
     try
       {
         dicomReader->Update();
       }
      catch (vtkstd::bad_alloc)
      {
         //It doesn't pass through here
      }
      catch (...)
      {
         //It doesn't pass through here
      }
//---------------------------------------------------------

Thank you in davance 

The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company Limited by Guarantee, Registered in England under Company No. 534147 with its Registered Office at 123 Old Brompton Road, London SW7 3RP.

This e-mail message is confidential and for use by the addressee only.  If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer and network.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101008/88f43bbb/attachment.htm>


More information about the vtkusers mailing list