Hi Sathish,<div><br></div><div>after some digging on what was going on with your code, I've figured out that the memory leak you were facing while using the VTK garbage collector was mainly due to Java who keep a reference to any graphical components that have been shown at some point.</div>
<div><br></div><div>And in your case, your graphical frame keep a reference to all your VTK objects (readers, filters, renderers...). And because of that, VTK could never release them.</div><div><br></div><div>In order to solve your specific issue you have to have some code like that in your WindowClosed listener:</div>
<div><br></div><div><div>private void formWindowClosed(java.awt.event.WindowEvent evt) {</div><div> this.myVtkObjectA = null;</div><div> // [...] </div><div> this.myVtkObjectZ = null;</div><div><br></div><div>
// but also remove the content of you renderer that will keep</div><div> // the whole pipeline alive in the C++ layer if not cleared</div><div> </div><div> this.myVtkPanel.RemoveAllViewProps();</div>
<div> this.myVtkPanel.GetRenderer().RemoveAllLights();</div><div> this.myVtkPanel.GetRenderWindow().RemoveRenderer(this.myVtkPanel.GetRenderer());</div><div>}</div></div><div><br></div><div>As you may see for vtkPanel we have a similar issue where its internal component won't be released, and for now in order to reduce the memory leak you need to execute the lines that I've put above with "myVtkPanel". </div>
<div><br></div><div>But in a near future, we will add a Delete() method on the vtkPanel to fully release its internal objects so the code block could be reduced to : this.myVtkPanel.Delete();</div>
<div><br></div><div>Moreover, Jeff and I are working of documenting the Java part of VTK and providing some tools to help identifying the cause of memory leak in Java as well as improving the concurrency support/management. So if some community member has Java/VTK testing code that produce error/crash because of concurrency or memory leak that could be used as test, please send them to us so we can make sure that the improvement that we are making will solve your issue.</div>
<div><br></div><div>Thanks,</div><div><br></div><div>Seb</div><div><br></div><div><br><div class="gmail_quote">On Wed, Apr 27, 2011 at 8:30 AM, Sebastien Jourdain <span dir="ltr"><<a href="mailto:sebastien.jourdain@kitware.com" target="_blank">sebastien.jourdain@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Sathish,<div><br></div><div>Do you think you can share your source code (offlist) so I can give a look and understand why you are facing this issue.</div>
<div><br></div><div>Thanks,</div><div><br></div><div>Seb</div><div><div></div><div><div>
<br><div class="gmail_quote">On Wed, Apr 27, 2011 at 2:07 AM, Sathish kumar <span dir="ltr"><<a href="mailto:kingvsk@aol.com" target="_blank">kingvsk@aol.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<font color="black" size="2" face="arial">
<font color="black" face="arial" size="2">
<div> <font face="Arial, Helvetica, sans-serif">Hi </font><font color="black" face="arial" size="2"><font color="black" face="arial" size="2"><font color="black" face="arial" size="2"><font><font color="black" face="arial" size="2">Sebastien,<br>
</font></font></font></font></font><font color="black" face="arial" size="2"><font color="black" face="arial" size="2"><font color="black" face="arial" size="2"><font color="black" face="arial" size="2"><font color="black" face="arial" size="2"><font><font color="black" face="arial" size="2"><br>
Thanks for your response.<br>
<br>
</font></font></font></font></font></font></font><font color="black" face="arial" size="2"><font color="black" face="arial" size="2"><font color="black" face="arial" size="2"><font><font color="black" face="arial" size="2"> I developed a simple application that loads a list of dicom images and construct them as 3D. It works fine. I call VTK from my Java Application. If I press a button from main window, then the VTK output will load in another Jframe window. Once I close the output window the VTK should release all the memory. But i doesn't do that. It will be released only when I close my main application. </font></font></font></font></font><font color="black" face="arial" size="2"><font color="black" face="arial" size="2"><font color="black" face="arial" size="2"><font color="black" face="arial" size="2"><font><font color="black" face="arial" size="2">(Please refer the attachment).<br>
<br>
My Requirement is while I close the 3D window The VTK memory should be released. <br>
</font></font></font></font></font></font>
</div><div>
<div> <br>
</div>
<div style="clear:both"><a style="font:lighter 10px Verdana,Arial;color:rgb(0, 0, 0)"><img src="http://presence.mail.aol.com/mailsig/?sn=kingvsk" align="absmiddle" border="0"></a> With Regards,<br>
<br>
Sathish Kumar V</div>
<br>
</div></font></font></blockquote></div><br></div>
</div></div></blockquote></div><br></div>