[vtk-developers] How to catch OutOfMemory errors using VTK with Java

Thomas Obenaus thomaso at eas.iis.fraunhofer.de
Wed Jun 24 04:01:43 EDT 2009



malat wrote:
> 
> On Mon, Jun 22, 2009 at 4:46 PM, Timothy M. Shead<tshead at sandia.gov>
> wrote:
>> Jeff Baumes wrote:
>>>
>>> Someone else may be able to answer better, but even if you wrote your
>>> application in C++, I don't think that VTK throws exceptions for things
>>> like
>>> out of memory errors.
>>
>> operator new throws a C++ exception for out-of-memory conditions, so any
>> code that invokes it (directly or indirectly) may cause an exception.
>> Converting those C++ exceptions into Java exceptions would require
>> modifications to the wrapper-generator, to put a try-catch block around
>> every method that calls into C++.  Boost.Python does this, for example.
> 
> The reason #1 you would reach a out-of-memory condition is within the
> vtkDataArray allocation. In VTK you should have a look at:
> 
> template <class T>
> int vtkDataArrayTemplate<T>::Allocate(vtkIdType sz, vtkIdType)
> 
> 
> it calls vtkErrorMacro which you can observe using vtkCommand::ErrorEvent
> 
> HTH
> -- 
> Mathieu
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
> 
> 
> 

Yes I can add an observer to be able to catch vtk-events like this one:
"vtkFloatArray (3B5D96D0): Unable to allocate 35099961 elements of size 4
bytes",
but I can not avoid that vtk causes my Java-Application to crash.

.."
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x04425fba, pid=2772,
tid=3368
#
# Java VM: Java HotSpot(TM) Client VM (11.0-b16 mixed mode, sharing
windows-x86)
# Problematic frame:..."

-- 
View this message in context: http://www.nabble.com/How-to-catch-OutOfMemory-errors-using-VTK-with-Java-tp23976349p24180346.html
Sent from the VTK - Dev mailing list archive at Nabble.com.




More information about the vtk-developers mailing list