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

Jeff Baumes jeff.baumes at kitware.com
Tue Nov 17 10:37:49 EST 2009


On Tue, Nov 17, 2009 at 10:08 AM, Baliki baliki <balikivtk at gmail.com> wrote:
> 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?

The idea was that you can use

vtkGlobalJavaHash.DeleteAll()

to get all the VTK C++ objects deleted before the program exits. This
is similar to closing open files in C before the program exits; it's
nice but not required. The OS should eliminate all memory used by the
program even if you do not call DeleteAll().

In reality, there are times when DeleteAll() has been found not to
entirely work (i.e. there are still VTK objects around after this
call). So you can choose to use it or not.

Jeff



More information about the vtkusers mailing list