The parallel computing experts should address this, but basically the solution to large data is to stream the data in pieces. While this is not always possible, VTK provides good support for this especially for image data. This means that your source object must be able to respond to data requests that are less than the whole extent of the image.<br>
<br>Also, make sure that you are setting the release data flags, etc. to discard memory in the pipeline when it is no longer needed.<br><br>W<br><br><div class="gmail_quote">On Tue, Jun 3, 2008 at 4:37 PM, Berk Geveci <<a href="mailto:berk.geveci@kitware.com">berk.geveci@kitware.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">If memory allocation fails, you will run into a crash sooner or later<br>
unfortunately. Even if you were to add such a check, somewhere down<br>
the pipeline some other class is going to die. IMHO, the only<br>
"graceful" way of handling this is to throw an exception that the<br>
application catches. Then it would have to report an error and shut<br>
down. Adding bunch of if statements for an exceptional case is<br>
probably not a good idea.<br>
<br>
-berk<br>
<br>
2008/6/3 Mathieu Coursolle <<a href="mailto:mcoursolle@rogue-research.com">mcoursolle@rogue-research.com</a>>:<br>
<div><div></div><div class="Wj3C7c">> Hi VTK developers,<br>
> I am performing a series of filters, where some of them are<br>
> vtkImageConvolve.<br>
> My input vtkImageData is usually close to 100Mbytes, and the execution of my<br>
> pipeline<br>
> seems to cause some memory fragmentation. Therefore, malloc will eventually<br>
> fail, causing<br>
> a crash in vtkImageConvolve.<br>
> If malloc fails during the execution of a pipeline, then the scalarPointer<br>
> of the resulting vtkImageData is NULL. If a connected vtkImageConvolve<br>
> filter receives such a vtkImageData<br>
> as its input, it tries to access the scalar pointer (which is NULL), causing<br>
> a crash.<br>
> A solution would be to check the pointers:<br>
>   // ADDED CODE BEGIN--------<br>
>   // Make sure the scalar pointers are valid.<br>
>   if (!inData[0][0]->GetScalarPointer() || !outData[0]->GetScalarPointer())<br>
>     {<br>
> vtkErrorMacro(<< "Execute: input and/or output image does not have any<br>
> scalar value.");<br>
>     return;<br>
>     }<br>
>   // ADDED CODE END--------<br>
><br>
><br>
><br>
>   switch (inData[0][0]->GetScalarType())<br>
>     {<br>
>     vtkTemplateMacro(<br>
>       vtkImageConvolveExecute(this, inData[0][0],<br>
>                               static_cast<VTK_TT *>(inPtr), outData[0],<br>
>                               static_cast<VTK_TT *>(outPtr),<br>
>                               outExt, id, inInfo));<br>
>     default:<br>
>       vtkErrorMacro(<< "Execute: Unknown ScalarType");<br>
>       return;<br>
>     }<br>
> So I was wondering,<br>
> 1) Is that the right way to avoid such crashes?<br>
> 2) I guess that problem might occur with other filters as well...<br>
> Thanks.<br>
> Mathieu<br>
><br>
</div></div>> _______________________________________________<br>
> vtk-developers mailing list<br>
> <a href="mailto:vtk-developers@vtk.org">vtk-developers@vtk.org</a><br>
> <a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
><br>
><br>
_______________________________________________<br>
vtk-developers mailing list<br>
<a href="mailto:vtk-developers@vtk.org">vtk-developers@vtk.org</a><br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>William J. Schroeder, PhD<br>Kitware, Inc.<br>28 Corporate Drive<br>Clifton Park, NY 12065<br><a href="mailto:will.schroeder@kitware.com">will.schroeder@kitware.com</a><br>
<a href="http://www.kitware.com">http://www.kitware.com</a><br>518-371-3971 (phone and fax)