[vtkusers] java: deleting vtk objects
Denis Barbier
bouzim at gmail.com
Tue Apr 21 04:33:09 EDT 2009
On 2009/4/20 Lars Matthäus wrote:
> Dear all (especially the java wrapping developers),
>
> how is the current state of releasing memory from VTK objects in Java? I
> have tried different things, but without success (in the following,
> image is a vtkImageData object, but that's only as an example):
>
> * image.ReleaseData();
> * image.Delete();
> * image.VTKDelete();
> * nothing (waiting for the Java gc)
>
> It seems as if some c++ call to release the memory is missing; the
> object is marked as deleted (for example, a call to image.GetSpacing()
> after image.Delete() leads to a crash ...), but as the process explorer
> shows me, no memory is ever released.
[...]
JVMs do not always release unused memory pages back to the OS, so
the process explorer may give wrong results. Put your code inside a loop;
if there are memory leaks, memory usage will grow and your app will crash.
Denis
More information about the vtkusers
mailing list