[vtkusers] VTK/Java crashes -- WeakGlobalRef or garbage collection problem...solution?
Denis Barbier
bouzim at gmail.com
Mon Dec 21 15:41:21 EST 2009
On 2009/12/21 Luke Dodd wrote:
>> * Add vtkJavaDisposeCurrent which calls vtkObjectBase.VTKDelete(idf) in the current thread (and thus mimic current behavior)
>
> If I understand you correctly vtkJavaDisposeCurrent would make the
> object be Deleted on whatever thread it was created?
[...]
I meant something like:
package vtk;
class vtkDisposeCurrent implements vtkIDisposeOnThread
{
public void disposeOnThread(long id)
{
vtkObjectBase.VTKDelete(id);
}
}
With this class, current behavior is unchanged, I do not understand
your objections here.
[...]
> There is one more problem I can imagine occurring. If some code
> running on the EDT creates lots of vtk objects, many of which can be
> disposed of after some point of execution, we could run out of memory
> before this code completes even though there are lots of objects
> available delete. The objects to delete would simply be on the end of
> the EDT queue and never get seen to because we would run out of memory
> first. Certainly an application could end up peaking at more memory
> usage than necessary. This is probably not as severe as it sounds,
> it's a corner case, but worth thinking about.
That's true in theory, but if you rely on memory being freed by a
thread before being allocated by another thread, you are likely to get
into trouble anyway.
> There is more detail in the last message I sent that you may or may
> not have read yet.
I did not understand this part, and am waiting for your implementation
to make an opinion ;-)
Denis
More information about the vtkusers
mailing list