[gclist] Fast-allocating non-copying GC's

Nick Barnes nickb@harlequin.co.uk
Wed, 06 Mar 1996 09:51:42 +0000


> >    [...] If you use fake copying (e.g., treadmill, or our variant) you
> >    can allocate almost as fast as with a copying GC, as well as getting
> >    back free memory in constant time.
> >
> >Sure, but there is an enormous space overhead:  For the treadmill, it
> >takes two pointers per object to maintain the doubly-linked list, which
> >is a major lose if you have lots of small objects.
> 
> For most apps, this is not an enormous cost.  We see average object sizes
> of 10 words for C and C++ apps, and I've heard the average for Smalltalk
> is about 8.  For things that use a lot of cdr-coded lists or boxed
> floats or whatever, your mileage will definitely vary.

This depends so much on the actual application. I've certainly seen
applications, even in C, which do huge amounts of 2-word and 4-word
allocation. In functional languages this is also the norm.

In C, of course, programmers have had twenty years to get used to the
typical trade-offs of the manual allocation model, and will almost
always write their own specialized allocator if they are faced with a
million calls of malloc(8). This is, IMO, a bad thing.

Nick Barnes (n'e Haines)