[vtkusers] JVM Crashes while Call vtkGlobalJavaHash.DeleteAll() in Ubuntu...

Sebastien Jourdain sebastien.jourdain at kitware.com
Fri May 6 06:55:55 EDT 2011


Interessting...

As no thread concurrency is involved here, I'm kind of wondering why this
happening. And without any warranty I would say either a nvidia driver issue
(try to update it) or vtk issue (try another version).
Do you know if that version works on Windows and Mac and only fails on Linux
?

Thanks,

Seb

On Fri, May 6, 2011 at 1:20 AM, Sathish Kumar <kingvsk at aol.com> wrote:

>  Hi Sebastien,
>
> I tried your code. But the JVM Carsh is done while starting the app. (JVM
> crash occurred While I press the button named "Dicom Multi Planner
> Reconstruction (2D)" in main form).
>
> Here with I attached the java crash report. Any suggestion?
>
> Thanks,
> Sathish,
>
>
> On Thursday 05 May 2011 07:03 PM, Sebastien Jourdain wrote:
>
> For your linux issue, I really have to try it on my linux, but so far I've
> tried your stuff at home on my Mac and as I was able to reproduce the leak
> with the GC, I had no need to go on Linux.
>
>  On Thu, May 5, 2011 at 2:04 AM, Sathish Kumar <kingvsk at aol.com> wrote:
>
>>  Hi Sebastien,
>>
>> Thanks for your suggestions. But that too not solve my problem. If
>> possible please send the whole code you corrected.
>>
>> I have one more question that the same code works great in windows and
>> Mac. The problem is only with linux. Is there any specific reason for that?
>>
>> --
>>  Sathish
>>
>>
>> On Thursday 05 May 2011 02:39 AM, Sebastien Jourdain wrote:
>>
>> Hi Sathish,
>>
>>  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.
>>
>>  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.
>>
>>  In order to solve your specific issue you have to have some code like
>> that in your WindowClosed listener:
>>
>>  private void formWindowClosed(java.awt.event.WindowEvent evt) {
>>      this.myVtkObjectA = null;
>>      // [...]
>>      this.myVtkObjectZ = null;
>>
>>       // but also remove the content of you renderer that will keep
>>      // the whole pipeline alive in the C++ layer if not cleared
>>
>>      this.myVtkPanel.RemoveAllViewProps();
>>      this.myVtkPanel.GetRenderer().RemoveAllLights();
>>
>> this.myVtkPanel.GetRenderWindow().RemoveRenderer(this.myVtkPanel.GetRenderer());
>> }
>>
>>  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".
>>
>>  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();
>>
>>  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.
>>
>>  Thanks,
>>
>>  Seb
>>
>>
>> On Wed, Apr 27, 2011 at 8:30 AM, Sebastien Jourdain <
>> sebastien.jourdain at kitware.com> wrote:
>>
>>> Hi Sathish,
>>>
>>>  Do you think you can share your source code (offlist) so I can give a
>>> look and understand why you are facing this issue.
>>>
>>>  Thanks,
>>>
>>>  Seb
>>>
>>> On Wed, Apr 27, 2011 at 2:07 AM, Sathish kumar <kingvsk at aol.com> wrote:
>>>
>>>>   Hi Sebastien,
>>>>
>>>> Thanks for your response.
>>>>
>>>>     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. (Please refer the attachment).
>>>>
>>>> My Requirement is while I close the 3D window The VTK memory should be
>>>> released.
>>>>
>>>>   With Regards,
>>>>
>>>> Sathish Kumar V
>>>>
>>>>
>>>
>>
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110506/54b053d8/attachment.htm>


More information about the vtkusers mailing list