[vtkusers] Error while close the VTK Window

Sathish Kumar kingvsk at aol.com
Mon May 23 02:24:35 EDT 2011


Hi Sebastien,

I accept your point. But it works without *memory leak*. Thats why I 
choosed DeleteAll() method. Anyway here after I won't use that.

As per your suggestion I tried the following code in Windows.
This too gives the same error window which is attached in the previous mail.

private void formWindowClosed(java.awt.event.WindowEvent evt) {
         // Garbage Collection...
         vpanAxial.GetRenderer().RemoveAllViewProps();
         vpanAxial.GetRenderer().RemoveAllLights();
         
vpanAxial.GetRenderWindow().RemoveRenderer(vpanAxial.GetRenderer());
         vpanAxial = null;
         vpanCoronal.GetRenderer().RemoveAllViewProps();
         vpanCoronal.GetRenderer().RemoveAllLights();
         
vpanCoronal.GetRenderWindow().RemoveRenderer(vpanCoronal.GetRenderer());
         vpanCoronal = null;
         vpanSagittal.GetRenderer().RemoveAllViewProps();
         vpanSagittal.GetRenderer().RemoveAllLights();
         
vpanSagittal.GetRenderWindow().RemoveRenderer(vpanSagittal.GetRenderer());
         vpanSagittal = null;

         resliceAxial = null;
         resliceCoronal = null;
         resliceSagittal = null;
         actorAxial = null;
         actorCoronal = null;
         actorSagittal = null;
         reader = null;

         System.gc();
         vtkGlobalJavaHash.GC();
     }

Thanks,
Sathish



On Saturday 21 May 2011 07:07 PM, Sebastien Jourdain wrote:
> Hi Sathish,
>
> You can give a try with that VTK. But for sure, you shouldn't call
> DeleteAll() because your Frame/Panel is still alive in the Java world.
>
> http://review.source.kitware.com/#q,status:open+project:VTK+branch:master+topic:vtk-java-improvement,n,z
>
> Seb
>
> PS: I didn't had the time yet to give a try of your code on my linux.
> PS2: You have to use the VTK garbage collector. Look at the code
> sample provided in the source...
>
> On Sat, May 21, 2011 at 1:47 AM, Sathish Kumar<kingvsk at aol.com>  wrote:
>> Hi All,
>>
>> I am using VTK Java Wrapper. In Windows I get an error window while I close
>> my vtkRenderWindow.
>>
>> My Code :
>>
>>     private void formWindowClosed(java.awt.event.WindowEvent evt) {
>>         // Garbage Collection...
>>         vtkGlobalJavaHash.DeleteAll();
>>     }
>>
>> If I delete the VTK objects Manually then it results in memory leak. But the
>> DeleteAll() method solves the memory leak but gives the following error
>> Message is a separate VTK Output Window. (Please find the attachment).
>>
>> Error: In ..\..\VTKSources\Rendering\vtkWin32OpenGLRenderWindow.cxx
>> vtkWin32OpenGLRenderWindow (047E5DA0): wglMakeCurrent failed in clean
>>
>> I can't scroll the error window to view further error message.
>>
>> Thanks in Advance,
>>
>> --
>> Sathish,
>>
>> _______________________________________________
>> 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
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110523/97fed615/attachment.htm>


More information about the vtkusers mailing list