<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><div>I agree that we should add a resolution for this issue in the upcoming VTK release. The problem is that VTKDelete() happens in finalize(), which is run on a separate thread and can cause concurrency issues. There are currently 3 proposed solutions (that I know of):</div>
<div><br></div><div>1. Use a shared mutex lock around every VTK call (including Delete()).</div><div>2. Have finalize() dispatch VTKDelete() calls to the thread that VTK objects are allocated/used (normally the event thread).</div>
<div>3. Have no finalizers, but periodically traverse vtkGlobalJavaHash and delete objects whose weak reference is null.</div><div><br></div><div>Denis Barbier has made patches on gitorious for solutions 1 and 2, originally made by Nathan Sharp and Luke Dodd:</div>
<div><br></div><div>On Unix:<br> $ git clone git://<a href="http://gitorious.org/~dbarbier/kitware/dbarbier-vtk.git" target="_blank" style="color: rgb(42, 93, 176); ">gitorious.org/~dbarbier/kitware/dbarbier-vtk.git</a> vtk-test<br>
 $ cd vtk-test<br> $ git checkout -b java/globalLock origin/java/globalLock<br> [build...install...test]<br> $ git checkout -b java/proxyFinalize origin/java/proxyFinalize<br> [build...install...test]<br></div><div><br></div>
<div>I think I prefer the proxyFinalize solution (solution 2 above), but others who have more experience with VTK+Java can give their opinions. I&#39;ll plan to check in a fix in the coming days.</div><div><br></div><div>
Thanks,</div><div>Jeff</div></span><br><div class="gmail_quote">On Mon, Mar 8, 2010 at 3:06 PM, <a href="mailto:egk865@yahoo.com">egk865@yahoo.com</a> <span dir="ltr">&lt;<a href="mailto:egk865@yahoo.com">egk865@yahoo.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><table cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top" style="font:inherit"><div><div>Back in December, there was a discussion on this list about improving vtk&#39;s Java binding to better handle the freeing of vtk resources during garbage collection. Some of the ideas mentioned were global locks or adding a cmake option for disabling deletion of vtk objects during garbage collection and require the user to manually call Delete().<br>
<br>With the recent announcement of the upcoming 5.6 branch, I was wondering if any final decisions have been made on this issue. Will there be any changes to the Java wrappers in the next release?<br><br>I&#39;ve experienced some of the crashes previously described and having already invested heavily in the Java wrappers for a moderately sized project (already close to 10000 lines of code) before becoming aware of these issues, I&#39;m really hoping the Java wrappers have a bright
 future.<br><br>Thanks,<br>Eli<br><br></div></div></td></tr></tbody></table><br>

      <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>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Jeff Baumes, Ph.D.<br>R&amp;D Engineer, Kitware Inc.<br>(518) 881-4932<br><a href="mailto:jeff.baumes@kitware.com">jeff.baumes@kitware.com</a><br>