[Xotcl] Re: [Xotcl] Almost working Garbage Collection

Uwe Zdun uwe.zdun at uni-essen.de
Wed May 30 15:23:48 CEST 2001


On Sunday 27 May 2001 15:16, Artur Trzewik wrote:
> Hi
> 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)
> http://www.xdobry.de/xotclref.tar.gz
> example
> Class A
> set a [A newReference]
> $a set a value
> set a {}
> the last procedure destroy the A object.
> Other examples works fine too.

yup. looks quite feasible ...

> 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.

can you give an example? Then we can see how to get around this problem for 
the next XOTcl release ...

> 2. The Garbage Collection procedures can be difficult made as
> Xotcl-extension.
> - 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.

The xotcl C API is still incomplete. Thus we can provide C hooks for 
customizing the creation/destruction process ... Do you just have to call   
doObjInitialization or are there other requirements?

> - 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 is
>   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.

in the XOTcl code it is mostly used with strings. Why does GetObject has to 
return the XOTclReferenceObject? Shouln't it always return the "real" object 
to which the reference points?


Uwe Zdun
Specification of Software Systems, University of Essen
Phone: +49 201 81 00 332, Fax: +49 201 81 00 398
zdun@{xotcl,computer,acm}.org, uwe.zdun at uni-essen.de

More information about the Xotcl mailing list