[vtkusers] VTK and Java Wrappers

Denis Barbier bouzim at gmail.com
Thu Mar 25 06:32:07 EDT 2010


On 2010/3/25 Lars Matthäus  wrote:
> Add-on: If I run the same program (without vtkGlobalJavaHash.GC() and
> without .Delete on the vtk objects) using the globalLock solution
> proposed before it runs for days without crashing or running out of
> memory. Hence I vote again for using the globalLock implementation in
> vtk5.6.
[...]

It has already been committed.
Your test case still crashes with
   http://github.com/Kitware/VTK/commit/448151155f5a5c5311c9b4949dd35230d3e23978
if calls to Delete() are removed.
If calls are enabled again, crashes do no more happen, but program
aborts because of an assertion in C++ code (after a much longer time):
   java: .../vtk/Common/vtkGarbageCollector.cxx:699: void
vtkGarbageCollectorImpl::CollectComponent(vtkGarbageCollectorImpl::ComponentType*):
Assertion `(*e)->Object->GetReferenceCount() == 1' failed.
If one replaces
  mapper.SetInput(arrowSource.GetOutput());
by
  final vtkPolyData data = arrowSource.GetOutput();
   mapper.SetInput(data);
and calls data.Delete() along with other Delete(), everything works
fine (but vtkJavaGarbageCollector does nothing since all objects are
explicitly deleted).

Denis



More information about the vtkusers mailing list