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

[Xotcl] Almost working Garbage Collection

From: Artur Trzewik <mail_at_xdobry.de>
Date: Sun, 27 May 2001 15:16:31 +0200

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.

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

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

Is there any internal Xotcl restrictions that makes xotclref impossible?

=========================================

 Artur Trzewik
 http://www.xdobry.de

=========================================