Re: References (was: Re: Is garbage collection here yet?)
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: References (was: Re: Is garbage collection here yet?)

From: Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at>
Date: Mon Mar 20 2006 - 20:29:14 CET

Darren New <dnew@san.rr.com> wrote:
> Andreas Leitgeb wrote:
>> B) Upon stringification (but *only* then!), a named reference is
>> autocreated.
>> Con: leakage possibly (though not as generally) re-introduced.
>
> How do you un-leak it? Assuming you even know that the reference was
> leaked, how do you go from string back to reference?

Nomenclature:
  "live ref": a Tcl_Obj of new "reference type"
  "stringified ref": the name of an auto-generated
      variable. Each stringification will create a
      new variable: this is necessary, so the
      programmer knows that no other code will
      share that autogenerated variable.
  "discard": what happens to an Tcl_Obj, when it's
      ref-count goees to 0.

To clean up a stringified ref, simply [unset] it.
The point is, that as long as the ref is never
stringified, no variable is ever created.

If you stringify it "on purpose" for later access, you'll
finally have to invalidate it manually.

Each variable can/should be unset, as soon as *you* think
that you won't use that particular stringified ref anymore.

Only after all live refs are discarded and all auto-vars are
deleted, the actually referenced Object will be discarded.

This was just a some brainstorming, on how one could deal
with the reference<->string problem.
Received on Sun Apr 30 02:42:08 2006