Re: Best Ref-counting algorithms?

torbenm@pc-003.diku.dk (Torben =?iso-8859-1?Q?=C6gidius?= Mogensen)
Tue, 14 Jul 2009 09:45:56 +0200

          From comp.compilers

Related articles
Best Ref-counting algorithms? lerno@dragonascendant.com (=?ISO-8859-1?Q?Christoffer_Lern=F6?=) (2009-07-12)
Re: Best Ref-counting algorithms? haberg_20080406@math.su.se (Hans Aberg) (2009-07-13)
Re: Best Ref-counting algorithms? lerno@dragonascendant.com (=?ISO-8859-1?Q?Christoffer_Lern=F6?=) (2009-07-13)
Re: Best Ref-counting algorithms? cr88192@hotmail.com (BGB / cr88192) (2009-07-13)
Re: Best Ref-counting algorithms? torbenm@pc-003.diku.dk (2009-07-14)
RE: Best Ref-counting algorithms? quinn_jackson2004@yahoo.ca (Quinn Tyler Jackson) (2009-07-14)
Re: Best Ref-counting algorithms? lerno@dragonascendant.com (=?ISO-8859-1?Q?Christoffer_Lern=F6?=) (2009-07-14)
Re: Best Ref-counting algorithms? haberg_20080406@math.su.se (Hans Aberg) (2009-07-14)
Re: Best Ref-counting algorithms? georgeps@xmission.com (GPS) (2009-07-14)
Re: Best Ref-counting algorithms? gneuner2@comcast.net (George Neuner) (2009-07-14)
Re: Best Ref-counting algorithms? DrDiettrich1@aol.com (Hans-Peter Diettrich) (2009-07-15)
[30 later articles]
| List of all articles for this month |
From: torbenm@pc-003.diku.dk (Torben =?iso-8859-1?Q?=C6gidius?= Mogensen)
Newsgroups: comp.compilers
Date: Tue, 14 Jul 2009 09:45:56 +0200
Organization: Department of Computer Science, University of Copenhagen
References: 09-07-018
Keywords: GC
Posted-Date: 14 Jul 2009 09:38:52 EDT

Christoffer Lernv <lerno@dragonascendant.com> writes:


> If one would like to implement a fast GC using refcounting, should I
> implement something like in those papers, or are there better
> algorithms out there?


If you want to implement a fast GC, you should not use refcounting. The
main problem with refcounting is that an assignment to a pointer
variable (which would otherwise just be a register-to-register transfer)
requires two memory reads, two memory writes and a conditional jump, so
it stresses the memory system far more than most other GC algorithms.


Refcounts should, IMO, only be used in the following circumstances:


  - Operations on heap pointers are very rare, so even a slow GC doesn't
      matter in the overall picture.


  - You need hard real-time guarantees.


  - The heap is shared between processes/processors with no central
      control.


So refcounts are fine for such things as shared libraries (you don't
very often add or delete references to these), but for a functional or
OO language where you have many small heap structures with short
lifetimes, it will give massive overhead.


Torben



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.