> -----Original Message----- > From: Jeff Sturm [mailto:[EMAIL PROTECTED]] > Sent: Monday, June 26, 2000 10:23 PM > To: Jiang Wu > Cc: [EMAIL PROTECTED] > Subject: [Tcl Java] Re: [Tcl Java] preserve/release or use GC > > Jiang Wu wrote: > > TclObject listElement = TclList.index(...); > > listElement.preserve(); > > listElement.toString(); > > listElement.release(); > > This doesn't seem too horrible... I don't have a problem with this personally. However, it does make TclBlend a bit more cumbersome since it is not the norm in Java programming to have to manually free any objects. This approach requires users of TclBlend to always do the preserve/release whenever they get a TclObject. A few more utility methods can help. There needs to be utility methods to return normal Java objects in place of TclObjects. That will make it easier to use for most programmers. For example: String TclList.elementAt(int i) which does all the preserve/release stuff. > I was thinking about adding a `next' member to CObject, to build a > singly-linked list of finalized objects without allocating memory. > Unfortunately it would still probably require synchronization. With careful programming, synchronization should not be a problem. Though I don't like the sound of delaying the finalization of the object. That may just be as bad as allocating new objects during finalization. -- 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