Re: [tcljava-dev] TclList finalize
Brought to you by:
mdejong
|
From: Daniel W. <da...@rt...> - 2000-12-20 21:25:57
|
>>>>> "Dan" == Dan Wickstrom <dcw...@ea...> writes:
>> Are you loading Tcl Blend into a running JVM or loading Tcl
>> Blend and a JVM into Tcl? I think it works for the second case,
>> but I don't know if it has ever worked in the first.
Dan> I've been loading Tcl Blend and a JVM into Tcl.. I can see
Dan> that the notifier has been alerted, but the notifier never
Dan> seems to run. I'm going to try and trace down where it's
Dan> failing.
It appears that this method of using the finalize method to send the
object to the notifier as an event will not work correctly. It is
possible for a tcl thread to exit before the garbage collector runs.
When the garbage collector does run and calls the finalize method, the
Tcl_ThreadAlert function will try to find the notifier for a thread
that is already cleaned up. In such a case, Tcl_ThreadAlert is a
no-op, and no error will be noticed. Of course the intended action of
cleaning up the corresponding Tcl_Obj's will not occur, and a memory
leak will result. It seems that we explicitly decrement reference
counts on TclObjects when we are finished with them, we need to create
some type of automated method of tracking the underlying Tcl_Obj's and
releasing them at thread exit.
-Dan
|