[Xotcl] Almost working Garbage Collection

Artur Trzewik mail at xdobry.de
Sun May 27 15:16:31 CEST 2001


TclJava was a good tip for implementing garbage collection in Xotcl.
(Thanks  Kristoffer Lawson)
It overwrites the cmdType from native tcl.
It is a little dirty and it can make problems by new tcl version,
but I was implemented by SUN by tcl-gurus.
The same think I have done by xotcl - references.
and it works partially.

(new snapshoot)

Class A
set a [A newReference]
$a set a value
set a {}

the last procedure destroy the A object.
Other examples works fine too.

There are some problems.
1. It do not work by Classes with destroy method.
I suppose it is the problem by reference counting by xotcl stack.
I do not understand how it work.

2. The Garbage Collection procedures can be difficult made as 

- The procedure doObjInitialization in not visible. At this time
 newReference do not accept any parameters. I am not so sure how I can
  implement the full object initialization with normal interface.

- xotcl.c use internal GetObject procedure this convert string to XOTclObject.
 I think it should use Tc_Obj as parameter. The most usage of this procedure 
  GetObject(in, ObjStr(objv[1])
  So. The procedure can check the type of Tcl_Obj directly and get XOTclObject
  from XOTclObjectType or my new (XOTclReferenceObjectType).
  And also increment the tcl_obj counter if it use the object local.

Is there any internal Xotcl restrictions that makes  xotclref impossible?


 Artur Trzewik 


More information about the Xotcl mailing list