<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
<!--
@font-face
{font-family:"MS Mincho"}
@font-face
{font-family:"Cambria Math"}
@font-face
{font-family:Calibri}
@font-face
{font-family:Tahoma}
@font-face
{font-family:Consolas}
@font-face
{font-family:"\@MS Mincho"}
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif"}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{margin:0in;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif"}
span.BalloonTextChar
{font-family:"Tahoma","sans-serif"}
span.EmailStyle19
{font-family:"Calibri","sans-serif";
color:#1F497D}
.MsoChpDefault
{}
@page WordSection1
{margin:1.0in 1.0in 1.0in 1.0in}
div.WordSection1
{}
-->
</style>
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">Hi Seb,</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">I tried using vtkPanel. The memory leak still persists.</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">Please find the attached source code and captured memory profile.</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="MsoNormal">My environtment:</p>
<p class="MsoNormal">VTK 7.0.0</p>
<p class="MsoNormal">CMake 3.1.1</p>
<p class="MsoNormal">Visual Studio Professional 2013</p>
<p class="MsoNormal">Eclipse Luna 4.4.1 (for my java application)</p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">As for library loader, the class just called bunch of System.loadLibrary.</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">Are there anything I can try?</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">Thank you,</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">Kenji</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt; font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt; font-family:"Tahoma","sans-serif""> Sebastien Jourdain [mailto:sebastien.jourdain@kitware.com]
<br>
<b>Sent:</b> Monday, April 18, 2016 5:19 PM<br>
<b>To:</b> Kenji Tsumura<br>
<b>Cc:</b> vtkusers@vtk.org<br>
<b>Subject:</b> Re: [vtkusers] Java vtkPanel</span></p>
<p class="MsoNormal"> </p>
<div>
<p class="MsoNormal">Hum, </p>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">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?)?</p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">I'm wondering which piece keep a ref on it...</p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">Seb</p>
</div>
</div>
<div>
<p class="MsoNormal"> </p>
<div>
<p class="MsoNormal">On Mon, Apr 18, 2016 at 4:06 PM, Kenji Tsumura <<a href="mailto:kenji.tsumura@neosoftmedical.com" target="_blank">kenji.tsumura@neosoftmedical.com</a>> wrote:</p>
<div>
<div>
<p class="MsoNormal" style=""><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">Hi Seb,</span></p>
<p class="MsoNormal" style=""><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="MsoNormal" style=""><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">Thank you for the advice.</span></p>
<p class="MsoNormal" style=""><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">So I change my test code as you suggested, but the problem still persists.</span></p>
<p class="MsoNormal" style=""><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; font-family:Consolas; color:black"> JFrameRenderer.</span><b><span style="font-size:10.0pt; font-family:Consolas; color:#7F0055">this</span></b><span style="font-size:10.0pt; font-family:Consolas; color:black">.remove(</span><span style="font-size:10.0pt; font-family:Consolas; color:#0000C0">renderWindowPanel</span><span style="font-size:10.0pt; font-family:Consolas; color:black">);</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; font-family:Consolas; color:black">
</span><span style="font-size:10.0pt; font-family:Consolas; color:#3F7F5F">// renderWindowPanel.Delete();</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; font-family:Consolas; color:black">
</span><span style="font-size:10.0pt; font-family:Consolas; color:#0000C0">renderWindowPanel</span><span style="font-size:10.0pt; font-family:Consolas; color:black"> =
</span><b><span style="font-size:10.0pt; font-family:Consolas; color:#7F0055">null</span></b><span style="font-size:10.0pt; font-family:Consolas; color:black">;</span></p>
<p class="MsoNormal" style=""><span style="font-size:10.0pt; font-family:Consolas; color:black"> vtkObject.</span><i><span style="font-size:10.0pt; font-family:Consolas; color:#0000C0">JAVA_OBJECT_MANAGER</span></i><span style="font-size:10.0pt; font-family:Consolas; color:black">.gc(</span><b><span style="font-size:10.0pt; font-family:Consolas; color:#7F0055">false</span></b><span style="font-size:10.0pt; font-family:Consolas; color:black">);</span></p>
<p class="MsoNormal" style=""><span style="font-size:10.0pt; font-family:Consolas; color:black"> </span></p>
<p class="MsoNormal" style=""><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">The attached shows the renderWindowPanel has not been released after 6 times of button click that triggers replacing the renderWindowPanel object.</span></p>
<p class="MsoNormal" style=""><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">Do I miss something?</span></p>
<p class="MsoNormal" style=""><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="MsoNormal" style=""><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">Thank you,</span></p>
<p class="MsoNormal" style=""><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="MsoNormal" style=""><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">Kenji</span></p>
<p class="MsoNormal" style=""><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="MsoNormal" style=""><b><span style="font-size:10.0pt; font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt; font-family:"Tahoma","sans-serif""> Sebastien Jourdain [mailto:<a href="mailto:sebastien.jourdain@kitware.com" target="_blank">sebastien.jourdain@kitware.com</a>]
<br>
<b>Sent:</b> Monday, April 18, 2016 4:32 PM<br>
<b>To:</b> Kenji Tsumura<br>
<b>Cc:</b> <a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a><br>
<b>Subject:</b> Re: [vtkusers] Java vtkPanel</span></p>
<div>
<div>
<p class="MsoNormal" style=""> </p>
<div>
<p class="MsoNormal" style="">Hi Kenji,</p>
<div>
<p class="MsoNormal" style=""> </p>
</div>
<div>
<p class="MsoNormal" style="">You can look at what we are doing with the delete() method of vtkPanel (knowing that we leak on Linux instead of crashing). </p>
</div>
<div>
<p class="MsoNormal" style="">But I'm guessing I see 3 possible issue in your code.</p>
</div>
<div>
<p class="MsoNormal" style=""> </p>
</div>
<div>
<p class="MsoNormal" style="">1) You should try to detach your renderWindowPanel instance from the parent JFrame.</p>
</div>
<div>
<p class="MsoNormal" style="">2) Then you should set it to null before calling vtkObject.JAVA_OBJECT_MANAGER.gc(false);</p>
</div>
<div>
<p class="MsoNormal" style="">3) And in any case, you should not call Delete() on it.</p>
</div>
<div>
<p class="MsoNormal" style=""> </p>
</div>
<div>
<p class="MsoNormal" style="">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.</p>
</div>
<div>
<p class="MsoNormal" style=""> </p>
</div>
<div>
<p class="MsoNormal" style="">Hope that helps,</p>
</div>
<div>
<p class="MsoNormal" style=""> </p>
</div>
<div>
<p class="MsoNormal" style="">Seb</p>
</div>
<div>
<p class="MsoNormal" style=""> </p>
</div>
<div>
<p class="MsoNormal" style="">PS: If ever you want to contribute your native library loader, please feel free to do so, I can facilitate the process. ;-)</p>
</div>
</div>
<div>
<p class="MsoNormal" style=""> </p>
<div>
<p class="MsoNormal" style="">On Mon, Apr 18, 2016 at 2:30 PM, Kenji Tsumura <<a href="mailto:kenji.tsumura@neosoftmedical.com" target="_blank">kenji.tsumura@neosoftmedical.com</a>> wrote:</p>
<div>
<div>
<p class="MsoNormal" style="">Hi,</p>
<p class="MsoNormal" style=""> </p>
<p class="MsoNormal" style="">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.</p>
<p class="MsoNormal" style=""> </p>
<p class="MsoNormal" style="">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.</p>
<p class="MsoNormal" style="">Thank you,</p>
<p class="MsoNormal" style=""> </p>
<p class="MsoNormal" style="">Kenji</p>
<p class="MsoNormal" style=""><span style="color:#222222"> </span></p>
<p class="MsoNormal" style=""><span style="color:black">“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.</span></p>
<p class="MsoNormal" style=""> </p>
</div>
<p class="MsoNormal" style="">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.
</p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">
http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">
http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" target="_blank">
http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a></p>
</div>
<p class="MsoNormal" style=""> </p>
</div>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal">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.
</p>
</div>
</div>
</div>
</div>
<p class="MsoNormal"> </p>
</div>
</div>
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.
</body>
</html>