Reference counting and tracing are two alternative approaches to [garbage collection]. ** Languages examples ** *** Languages that use reference counting *** * [Perl] * [Python] (with cycle detection) * [Tcl] *** Languages that use a tracing GC *** * [Java] * [Jim Tcl] ** See also ** * [http://lambda-the-ultimate.org/node/4155%|%Lambda the Ultimate discussion] **Discussion** [DKF]: Tcl uses reference counting, and can largely get away with it because it has no reference loops. If you try to put a value inside itself (e.g., with [lset] or [dict set]) the value gets duplicated (because of copy-on-write) and the container becomes the new value. This does depend on the model-immutability of Tcl's value system though, and is the reason why we tend to be ''very'' strict on maintaining that model: merely ''allowing'' reference loops would ''require'' us to change our memory management system. There are advantages to using reference counting, of course. In particular, it allows us to integrate with C libraries relatively easily and it is typically parsimonious in its memory use (though we cede some of that for greater thread performance). Garbage collection, while potentially faster, has greater memory overheads and higher impedance with C. <>Concept