[vtkusers] VTK/Java crashes -- WeakGlobalRef or garbage collection problem...solution?

Denis Barbier bouzim at gmail.com
Sat Dec 26 06:13:33 EST 2009


On 2009/12/23 Nathan P Sharp <vtkusers at nps.parcellsharp.net>:
> Denis Barbier escribió:
>>
>> Exactly, sorry if my wording was unclear.
>>
>> I pushed another branch java/proxyFinalize2 to gitorious with these
>> changes.  When writing it, I found that Nathan's implementation is
>> still subject to bug 8942; finalize() does not call Delete, and thus
>> object is not removed from the global hash.  Nathan, do you want to
>> fix it, or do I merge proxyFinalize2 into proxyFinalize?  Or did I
>> miss something?
>>
> Denis,
>  It shouldn't matter since the Java Garbage Collector will null out the
> weak reference for you.  However, explicitly removing it is a good idea
> anyhow (especially since I'll be voting to have an option to override
> the weak ref with a user supplied strong ref later).

I looked at the documentation for weak references again, and you are
right, there is no bug  in your code, all weak references to the
object are cleared before it is finalized.  Thus I am not sure that
removing it explicitly is such a good idea, a comment to explain that
it is not needed may be better.  My java/proxyFinalize2 branch is
useless for now.

Denis



More information about the vtkusers mailing list