View · Search · Index
No registered users in community xowiki
in last 10 minutes

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

From: Uwe Zdun <uwe.zdun_at_uni-essen.de>
Date: Wed, 30 May 2001 15:23:48 +0200

Hi,

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


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