[vtkusers] VTK/Java crashes -- WeakGlobalRef or garbage collection problem...solution?

Baliki baliki balikivtk at gmail.com
Tue Nov 17 10:08:55 EST 2009


Many thanks Jeff. I really appreciate your effort to solve the problem.
I try what you syggest and post the results.

If i use global vtk object, should i use vtkGlobalJavaHash.DeleteAll() in
order to delete them?
Or the system frees the memory automatically when the program exits?

Baliki

2009/11/17 Jeff Baumes <jeff.baumes at kitware.com>

> On Tue, Nov 17, 2009 at 9:42 AM, Baliki baliki <balikivtk at gmail.com>
> wrote:
>
> Ok. You really need to keep some VTK object stored externally. It's an
> artifact of the wrapping system, but not a bug that can be fixed (at
> least to my knowledge). There needs to always be a VTK object (or set
> of objects) that is not out-of-scope that will keep references to
> everything, otherwise all VTK objects will be deleted on garbage
> collection. In your case just storing the render window at the class
> level should do the trick.
>
> Not sure why this would not be an issue with a different reader.
> Perhaps the other reader uses less memory and Java does not
> garbage-collect as soon, so it appears to work a long time?
>
> Jeff
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091117/44e5f2ee/attachment.htm>


More information about the vtkusers mailing list