[vtkusers] VTK/Java crashes -- WeakGlobalRef or garbage collection problem...solution?
Denis Barbier
bouzim at gmail.com
Mon Dec 21 13:14:06 EST 2009
On 2009/12/21 Luke Dodd wrote:
[...]
> Nathan's solution is nice and flexable. The problem I have is with the
> default implementation dumping lot's of Runnables onto the Event queue
> every time garbage collection is run, this seems like it might not be
> such a good idea when many objects need to be cleaned up (pehaps the
> cost of this is not so high, some test cases should help figure this
> out).
For those not familiar with Java, in Swing, all GUI operations are
performed in the so-called Event Dispatch Thread. I think that Luke's
concern is that if many objects are being finalized, this can take
some time to process and GUI is then frozen and unresponsive. In my
tests, I did not notice any such problem.
> Of course this can be fixed by tweaking what the default
> behaviour is, and the user can ultimately control this.
Maybe we could:
* Rename vtkDefaultDispose into vtkJavaDisposeEDT
* Add vtkJavaDisposeCurrent which calls vtkObjectBase.VTKDelete(idf)
in the current thread (and thus mimic current behavior)
I believe that vtkJavaDisposeEDT should still be the default behavior.
Denis
More information about the vtkusers
mailing list