[Baypiggies] Frequently Argued Objections

Aahz aahz at pythoncraft.com
Fri Jun 20 16:46:55 CEST 2008


On Thu, Jun 19, 2008, Seth Friedman wrote:
>
> i don't really understand what the material difference between
> reference counting and GC is, or why it's so significant. or posed
> differently, if ref counting is obviously so much cheaper/easier, why
> can't java do it? not that i expect you to be able to answer that,
> fraglets of info are interesting.

Summary, vastly oversimplified (and probably containing some technical
inaccuracies, particularly WRT current state of the art for GC):

With reference counting, each object maintains an internal counter
specifying how many references are attached to the object; when the
counter goes to zero, the object deletes itself.  This relies on every
aspect of the system correctly manipulating the counter.

GC goes the other direction, where an object is registered once at
creation time, and separately there is a pointer linking in a chain from
"root objects" to all other objects.  Every once in a while, the chain
is scanned to find objects that are registered but not linked.  Such
objects get deleted.

GC requires less record-keeping, but it is non-deterministic when
objects will be deleted.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"as long as we like the same operating system, things are cool." --piranha


More information about the Baypiggies mailing list