[vtkusers] VTK and Garbage Collection
Jeff Lee
jeff at cdnorthamerica.com
Thu May 29 09:45:08 EDT 2003
Shyam,
All you did was thread off your open() method. the way swingworker
works is it starts the construct() method in a thread, and then invokes
finished() on the event thread. you need to implement the finished()
method in your swingworker. I would suggest that you don't do anything
related to ui/graphics in your construct() method, rather save it for
the finished() method. is this clear?
-Jeff
R K Shyamprakash wrote:
>Jeff,
> part of the file where I use the SwingWorker is attached.
>
>Thanks
>Shyam
>
>-----Original Message-----
>From: vtkusers-admin at public.kitware.com
>[mailto:vtkusers-admin at public.kitware.com]On Behalf Of Jeff Lee
>Sent: Thursday, May 29, 2003 6:50 PM
>To: R K Shyamprakash
>Cc: 'Vtkusers (E-mail)'
>Subject: Re: [vtkusers] VTK and Garbage Collection
>
>
>can you post a code snippet of how you use SwingWorker?
>-Jeff
>
>R K Shyamprakash wrote:
>
>
>
>>Jeff,
>> I did use SwingWorker. Say, I am loading an object into my VTK+JAVA
>>application. This takes few seconds during which my Java repaint thread is
>>blocked(Considering I call VTK objects from the event thread). If I call
>>
>>
>the
>
>
>>same objects from a SwingWorker, the repaint problem seems to have reduced.
>>the object loads well into vtkCanvas but as soon as I move my mouse over it
>>VTK throws following error.
>>
>>ERROR:vtkWin32OpenGLRenderWindow
>>vtkWin32OpenGLRenderWindow:wglMakeCurrent failed.
>>
>>I have applied locks where ever necessary. I don't get this problem when I
>>run the application from the event dispatching thread. Is there any work
>>around for this?
>>
>>Thanks
>>Shyam
>>
>>
>>
>>-----Original Message-----
>>From: vtkusers-admin at public.kitware.com
>>[mailto:vtkusers-admin at public.kitware.com]On Behalf Of Jeff Lee
>>Sent: Thursday, May 29, 2003 3:58 PM
>>To: R K Shyamprakash
>>Cc: Vtkusers (E-mail)
>>Subject: Re: [vtkusers] VTK and Garbage Collection
>>
>>
>>
>>
>>R K Shyamprakash wrote:
>>
>>
>>
>>
>>
>>>Hi,
>>> My VTK application becomes slower after few operations and
>>>sometimes it locks the processor. How can I garbage collect VTK objects so
>>>that serious memory concerns does not arise.
>>>
>>>
>>>
>>>
>>>
>>how do you know that the slowdown is related to memory consumption? vtk
>>objects, as all java objects are garbage collected when they are no
>>longer referenced by any other object. do you notice an increase in
>>performance after garbage collection runs?
>>
>>
>>
>>
>>
>>> I am using VTK 4.2 with Java. Also the Java component have repaint
>>>
>>>
>problem
>
>
>>>when an intensive vtk operation is going on. Is there any work around for
>>>this.
>>>
>>>
>>>
>>>
>>>
>>common problem due to the fact that you are likely tying up the event
>>thread with your calculation. there are a variety of solutions to this,
>>one being to thread the calculation. look for the SwingWorker class on
>>java website for more details.
>>Jeff
>>
>>
>>
>>
>>
>>>Thanks
>>>Shyam
>>>
>>>
>>>
More information about the vtkusers
mailing list