I converted all TclList.index(..).toString() into a safer manner using
preserve/release.  Then I ran through the tclblend test suite.  The bad news
is that there are still hundreds of Tcl_Obj's being leaked.

The tcljava code uses many temporary TclObjects.  A few examples of how
these temporary TclObjects being created:

 // using TclList.index result without preserve/release
 index = TclInteger.get(interp, 
            TclList.index(interp, indexListObj, numDims - 1));

 // returning TclObject from setVar is not referenced
 interp.setVar("tcljava", "tcljava",
           TclString.newInstance("jacl"), TCL.GLOBAL_ONLY);

 // plat is not preserved or released
 TclObject plat = interp.getVar("tcl_platform", "platform",
                                   TCL.GLOBAL_ONLY);

A different solution is needed.  What about never returning any CObjects in
TclBlend?  Methods such as interp.setVar, interp.getVar, interp.getResult
still returns TclObject, but the resulting TclObject would not contain
CObject as the internal rep.  For example, any Tcl_Obj can be converted into
a TclString representation.  Then the TclString is returned inside a
TclObject.  TclString can be safely GC'ed because it has no link to any Tcl
C data structures.

-- Jiang Wu
   [EMAIL PROTECTED]

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