[vtkusers] Java vtkPanel
Sebastien Jourdain
sebastien.jourdain at kitware.com
Tue Apr 19 14:29:54 EDT 2016
Hi Kenji,
Nothing comes to my mind on what could keep a reference to those classes.
Having them listing somehow reduce the search area.
Regarding the interactor. It seems you don't need it as you don't have 3D
widgets or picking. That interactor can be managed on the Java side like
vtkPanel is doing. I'm not saying you must go that route, but that was one
of a suggestion to see if for some reason a thread was keeping a reference
to that interactor. Although based on the latest output, it does not seems
to be the case as it get properly cleaned up.
I don't have any clue on how to figure it out without spending some time
looking at that issue myself.
Good luck with your investigation,
Seb
On Tue, Apr 19, 2016 at 11:52 AM, Kenji Tsumura <
kenji.tsumura at neosoftmedical.com> wrote:
> Hi Seb,
>
>
>
> Here is the information I got. vtkOpenGLLight, vtkOpenGLCamera,
> vtkWin32OpenGLRenderWindow, and vtkOpenGLRenderer are not disposed. When
> vtkRenderWindowPanel is used, two vktLight objects are instantiated, and
> only one of them are disposed.
>
> Do we have any suggestion on how to dispose these objects?
>
>
>
> Using vtkPanel
>
> List of classes kept in Java layer:
>
> - vtkOpenGLLight: 1
>
> - vtkOpenGLCamera: 1
>
> - vtkWin32OpenGLRenderWindow: 1
>
> - vtkOpenGLRenderer: 1
>
>
>
> List of classes removed in Java layer:
>
> - vtkOpenGLPolyDataMapper: 1
>
> - vtkOpenGLActor: 1
>
> - vtkInteractorStyleTrackballCamera: 1
>
> - vtkGenericRenderWindowInteractor: 1
>
> - vtkSphereSource: 1
>
> - vtkAlgorithmOutput: 1
>
>
>
>
>
> Using vtkCanvas
>
> List of classes kept in Java layer:
>
> - vtkOpenGLLight: 1
>
> - vtkOpenGLCamera: 1
>
> - vtkWin32OpenGLRenderWindow: 1
>
> - vtkOpenGLRenderer: 1
>
>
>
> List of classes removed in Java layer:
>
> - vtkOpenGLPolyDataMapper: 1
>
> - vtkOpenGLActor: 1
>
> - vtkInteractorStyleTrackballCamera: 2
>
> - vtkGenericRenderWindowInteractor: 1
>
> - vtkSphereSource: 1
>
> - vtkBoxWidget: 1
>
> - vtkAlgorithmOutput: 1
>
> - vtkPlaneWidget: 1
>
>
>
>
>
> Using vtkRenderWindowPanel
>
> List of classes kept in Java layer:
>
> - vtkOpenGLLight: 1
>
> - vtkOpenGLCamera: 1
>
> - vtkWin32OpenGLRenderWindow: 1
>
> - vtkOpenGLRenderer: 1
>
>
>
> List of classes removed in Java layer:
>
> - vtkOpenGLLight: 1
>
> - vtkOpenGLPolyDataMapper: 1
>
> - vtkOpenGLActor: 1
>
> - vtkInteractorStyleTrackballCamera: 2
>
> - vtkGenericRenderWindowInteractor: 1
>
> - vtkSphereSource: 1
>
> - vtkBoxWidget: 1
>
> - vtkAlgorithmOutput: 1
>
> - vtkPlaneWidget: 1
>
>
>
> BTY,
>
> >Do you need the interactor?
>
> Yes. We need to interact with users (rotation, pan, WW/WL, etc).
>
> > Are you using 3D widgets or picking?
>
> No, at the moment.
>
>
>
> Thank you,
>
>
>
> Kenji
>
> *From:* Sebastien Jourdain [mailto:sebastien.jourdain at kitware.com]
> *Sent:* Tuesday, April 19, 2016 10:42 AM
>
> *To:* Kenji Tsumura
> *Cc:* vtkusers at vtk.org
> *Subject:* Re: [vtkusers] Java vtkPanel
>
>
>
> You should have kept "vtkObject.JAVA_OBJECT_MANAGER.gc(false);"
>
> Moreover, you can try with "true" so it will print out the actual classes
> that have been released.
>
>
>
> One thing that I'm not sure of, is that you start the interactor and I'm
> wondering if a thread is keeping a reference to the full tree in some way
> which prevent the structure to be cleaned up. Do you need the interactor?
> Are you using 3D widgets or picking? If so vtkCanvas might be a better fit
> as vtkPanel implement in the Java World a trackball type of interaction
> without using the vtkInteractor object.
>
>
>
> Seb
>
>
>
> On Tue, Apr 19, 2016 at 8:54 AM, Kenji Tsumura <
> kenji.tsumura at neosoftmedical.com> wrote:
>
> Hi Seb,
>
>
>
> I tried using vtkPanel. The memory leak still persists.
>
> Please find the attached source code and captured memory profile.
>
>
>
> My environtment:
>
> VTK 7.0.0
>
> CMake 3.1.1
>
> Visual Studio Professional 2013
>
> Eclipse Luna 4.4.1 (for my java application)
>
>
>
> As for library loader, the class just called bunch of System.loadLibrary.
>
>
>
> Are there anything I can try?
>
> Thank you,
>
>
>
> Kenji
>
>
>
>
>
> *From:* Sebastien Jourdain [mailto:sebastien.jourdain at kitware.com]
> *Sent:* Monday, April 18, 2016 5:19 PM
>
>
> *To:* Kenji Tsumura
> *Cc:* vtkusers at vtk.org
> *Subject:* Re: [vtkusers] Java vtkPanel
>
>
>
> Hum,
>
>
>
> Out of curiosity can you try using vtkPanel instead and calling its Java
> implementation of the delete() function and see if you can see it disappear
> or not within you tool (NetBean?)?
>
>
>
> I'm wondering which piece keep a ref on it...
>
>
>
> Seb
>
>
>
> On Mon, Apr 18, 2016 at 4:06 PM, Kenji Tsumura <
> kenji.tsumura at neosoftmedical.com> wrote:
>
> Hi Seb,
>
>
>
> Thank you for the advice.
>
> So I change my test code as you suggested, but the problem still persists.
>
>
>
> JFrameRenderer.*this*.remove(renderWindowPanel);
>
> // renderWindowPanel.Delete();
>
> renderWindowPanel = *null*;
>
> vtkObject.*JAVA_OBJECT_MANAGER*.gc(*false*);
>
>
>
> The attached shows the renderWindowPanel has not been released after 6
> times of button click that triggers replacing the renderWindowPanel object.
>
> Do I miss something?
>
>
>
> Thank you,
>
>
>
> Kenji
>
>
>
> *From:* Sebastien Jourdain [mailto:sebastien.jourdain at kitware.com]
> *Sent:* Monday, April 18, 2016 4:32 PM
> *To:* Kenji Tsumura
> *Cc:* vtkusers at vtk.org
> *Subject:* Re: [vtkusers] Java vtkPanel
>
>
>
> Hi Kenji,
>
>
>
> You can look at what we are doing with the delete() method of vtkPanel
> (knowing that we leak on Linux instead of crashing).
>
> But I'm guessing I see 3 possible issue in your code.
>
>
>
> 1) You should try to detach your renderWindowPanel instance from the
> parent JFrame.
>
> 2) Then you should set it to null before
> calling vtkObject.JAVA_OBJECT_MANAGER.gc(false);
>
> 3) And in any case, you should not call Delete() on it.
>
>
>
> I'm thinking your code may cleanup its memory but not the first time you
> do it. After 3 times, you only cleared the first allocated memory.
>
>
>
> Hope that helps,
>
>
>
> Seb
>
>
>
> PS: If ever you want to contribute your native library loader, please feel
> free to do so, I can facilitate the process. ;-)
>
>
>
> On Mon, Apr 18, 2016 at 2:30 PM, Kenji Tsumura <
> kenji.tsumura at neosoftmedical.com> wrote:
>
> Hi,
>
>
>
> I have a Java application that use vtkPanel. Precisely, I made a class
> that extends vtkRenderWindowPanel. When an object of the class is no more
> used, I would like to dispose the object. But I couldn’t dispose it no
> matter how. Java VisualVM indicates the object is JNI global reference.
> So how can I dispose it? I used the Delete method and called
> vtkObject.JAVA_OBJECT_MANAGER.gc(false), but it didn’t work (it works for
> other VTK objects). The attached file is a simple test code that
> demonstrates vtkRenderWindowPanel is never disposed.
>
>
>
> I have seen similar post in the past, but never be answered in the way I
> hope. So I decided to post. I would appreciate any advice.
>
> Thank you,
>
>
>
> Kenji
>
>
>
> “The information contained in this communication may be confidential, is
> intended only for the use of the recipient(s) named above, and may be
> legally privileged. If the reader of this message is not the intended
> recipient, you are hereby notified that any dissemination, distribution, or
> copying of this communication, or any of its contents, is strictly
> prohibited. If you have received this communication in error, please return
> it to the sender immediately and delete the original message and any copy
> of it from your computer system. If you have any questions concerning this
> message, please contact the sender.
>
>
>
> Disclaimer: The information contained in this communication may be
> confidential, is intended only for the use of the recipient(s) named above,
> and may be legally privileged. If the reader of this message is not the
> intended recipient, you are hereby notified that any dissemination,
> distribution, or copying of this communication, or any of its contents, is
> strictly prohibited. If you have received this communication in error,
> please return it to the sender immediately and delete the original message
> and any copy of it from your computer system. If you have any questions
> concerning this message, please contact the sender.
>
>
> _______________________________________________
> 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
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>
>
> Disclaimer: The information contained in this communication may be
> confidential, is intended only for the use of the recipient(s) named above,
> and may be legally privileged. If the reader of this message is not the
> intended recipient, you are hereby notified that any dissemination,
> distribution, or copying of this communication, or any of its contents, is
> strictly prohibited. If you have received this communication in error,
> please return it to the sender immediately and delete the original message
> and any copy of it from your computer system. If you have any questions
> concerning this message, please contact the sender.
>
>
>
> Disclaimer: The information contained in this communication may be
> confidential, is intended only for the use of the recipient(s) named above,
> and may be legally privileged. If the reader of this message is not the
> intended recipient, you are hereby notified that any dissemination,
> distribution, or copying of this communication, or any of its contents, is
> strictly prohibited. If you have received this communication in error,
> please return it to the sender immediately and delete the original message
> and any copy of it from your computer system. If you have any questions
> concerning this message, please contact the sender.
>
>
> Disclaimer: The information contained in this communication may be
> confidential, is intended only for the use of the recipient(s) named above,
> and may be legally privileged. If the reader of this message is not the
> intended recipient, you are hereby notified that any dissemination,
> distribution, or copying of this communication, or any of its contents, is
> strictly prohibited. If you have received this communication in error,
> please return it to the sender immediately and delete the original message
> and any copy of it from your computer system. If you have any questions
> concerning this message, please contact the sender.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160419/3b0cec53/attachment.html>
More information about the vtkusers
mailing list