Something has been bothering me about this ref counting stuff for
some time. It just seems like the TclJava ref counting does not
work like regular Tcl ref counting, but I could not put my
finger on exactly why.

I was just looking at the C code, and I noticed that "regular"
Tcl ref counts start at 1 while Tcl/Java ref counts start at 0.

(from tclBasic.c)

    cmdPtr = (Command *) ckalloc(sizeof(Command));
    Tcl_SetHashValue(hPtr, cmdPtr);
    cmdPtr->hPtr = hPtr;
    cmdPtr->nsPtr = nsPtr;
    cmdPtr->refCount = 1;
    cmdPtr->cmdEpoch = 0;

(from TclObject.java)

    protected TclObject(TclString rep, String s) {
        internalRep = rep;
        stringRep = s;
        refCount = 0;
    }

Seems like that might be the cause of some big problems.
I think this was something that was changed in Tcl sometime
after Tcl 8.0.

Mo DeJong
Red Hat Inc

----------------------------------------------------------------
The TclJava mailing list is sponsored by Scriptics Corporation.
To subscribe:    send mail to [EMAIL PROTECTED]  
                 with the word SUBSCRIBE as the subject.
To unsubscribe:  send mail to [EMAIL PROTECTED] 
                 with the word UNSUBSCRIBE as the subject.
To send to the list, send email to '[EMAIL PROTECTED]'. 
An archive is available at http://www.mail-archive.com/tcljava@scriptics.com

Reply via email to