[vtkusers] VtkPanel in java vtk bindings not being collected?

Sebastien Jourdain sebastien.jourdain at kitware.com
Thu Jul 31 11:46:15 EDT 2014


There is a Delete() method on it. But on Linux, vtkPanel leak to prevent a
crash.

  public void Delete() {
    if(rendering) {
      return;
    }
    rendering = true;
    // We prevent any further rendering

    if (this.getParent() != null) {
      this.getParent().remove(this);
    }
    // Free internal VTK objects
    ren = null;
    cam = null;
    lgt = null;
    // On linux we prefer to have a memory leak instead of a crash
    if(!rw.GetClassName().equals("vtkXOpenGLRenderWindow")) {
      rw = null;
    } else {
      System.out.println("The renderwindow has been kept arount to prevent
a crash");
    }
  }


On Thu, Jul 31, 2014 at 9:39 AM, MarkHammons <mark.hammons at inaf.cnrs-gif.fr>
wrote:

> Here's my code (in scala): http://pastie.org/9434555
>
> The class above creates a simple viewing window for structuredpoints data
> it's initialized with. When switching images, my program currently unhooks
> the ImageViewer and disposes of any references to it. It also calls the
> end() method that you see in the code. The result is the ImageViewer and a
> large number of the vtk objects are cleaned up by the garbage collector
> EXCEPT the opengl lights, the renderer and renderwindow, and most
> confusingly of all, the vtkpane. According to visualvm's heap dump
> inspection, when vtkPanel is not being collected by the garbage collector,
> there is no references to it on the java side to keep it alive. Even the
> parent class ImageViewer is collected.
>
> Am I missing some special command I need to call to get VtkPanel to
> deallocate properly?
>
>
>
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/VtkPanel-in-java-vtk-bindings-not-being-collected-tp5728036.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20140731/0b1e65f8/attachment.html>


More information about the vtkusers mailing list