Thread: [tcljava-dev] TclList finalize
Brought to you by:
mdejong
From: Daniel W. <da...@rt...> - 2000-12-18 22:55:29
|
Looking at the latest sources, I noticed that the TclList class doesn't have a finalize method declared. Since TclList is a subclass of CObject, shouldn't it have a finalize method for sending the TclList object as an event to the notifier for later cleanup? -Dan |
From: Mo D. <md...@cy...> - 2000-12-18 23:01:02
|
On Mon, 18 Dec 2000, Daniel Wickstrom wrote: > Looking at the latest sources, I noticed that the TclList class > doesn't have a finalize method declared. Since TclList is a subclass > of CObject, shouldn't it have a finalize method for sending the > TclList object as an event to the notifier for later cleanup? > > -Dan Since TclList extends CObject, calling finalize() for the TclList should invoke CObject.finalize(). Mo DeJong Red Hat Inc |
From: Daniel W. <da...@rt...> - 2000-12-19 16:07:20
|
>>>>> "Mo" == Mo DeJong <md...@cy...> writes: Mo> On Mon, 18 Dec 2000, Daniel Wickstrom wrote: >> Looking at the latest sources, I noticed that the TclList class >> doesn't have a finalize method declared. Since TclList is a >> subclass of CObject, shouldn't it have a finalize method for >> sending the TclList object as an event to the notifier for >> later cleanup? >> >> -Dan Mo> Since TclList extends CObject, calling finalize() for the Mo> TclList should invoke CObject.finalize(). Duh ok. Anyway I uncommented the debug statement that you had in CObject.processEvent to see if it is ever called, and I never see the debug output. Did you see this working before? -Dan |
From: Mo D. <md...@cy...> - 2000-12-20 01:10:12
|
On Tue, 19 Dec 2000, Daniel Wickstrom wrote: > Anyway I uncommented the debug statement that you had in > CObject.processEvent to see if it is ever called, and I never see the > debug output. Did you see this working before? > > -Dan 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. We really need to test this sort of thing. There is also a problems with threads. I was thinking that we could #define in some code when debugging that would maintain a table listing the threads that were initialized and those that were cleaned up. We could then check this "cleanup table" to make sure things were getting taken down properly. Mo DeJong Red Hat Inc |
From: Dan W. <dcw...@ea...> - 2000-12-20 13:20:11
|
> 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. I've been loading Tcl Blend and a JVM into Tcl.. I can see that the notifier has been alerted, but the notifier never seems to run. I'm going to try and trace down where it's failing. > We really need to test this sort of thing. > There is also a problems with threads. > I was thinking that we could #define in > some code when debugging that would > maintain a table listing the threads > that were initialized and those that > were cleaned up. We could then check > this "cleanup table" to make sure > things were getting taken down properly. I haven't seen this problem where only some of the threads are not taken down properly. That sounds really strange. -Dan |
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 |