oo hardware

Marcel Weiher marcel at metaobject.com
Sat Mar 22 21:03:22 UTC 2003


> Marcel Weiher <marcel at metaobject.com> wrote:
> [snip]
>> Hmm...if you have a 32 bit reference count field, a 32 bit address
>> space for your objects and a minimum of 4 bytes for your objects, then
>> I would think reference counting *is* exact, because you can 
>> accomodate
>> 2^32 references to your object but can never have that many objects in
>> your system.  (Assuming that the number of external references is 
>> small)
> A 32bit refCt field is effectively infinite for a 32bit address space -

OK. that's what I thought.

> in fact it would probably be effectively infinite for about 36bits of
> addresspace given likely object average sizes. BUT, and this is a big
> 'but' (like, say, jennifer lopez) given typical object sizes (I think 
> we
> can still guess at 16 bytes as the upper number for that) we are then
> spending 4 more bytes for the refct field, ie 20% 'wastage'.

Not necessarily.  For example, Foundation (part of what is now known as 
Cocoa) has an "external reference count" facility.  Any overflows are 
handled externally, which means you must have a way of dealing with 
overflow, but the count is still precise.  Slow as hell, but precise.

>  Under some
> circumstances and with modern systems and memory costs maybe that isn't
> a terrible thing anymore?

Yes.  For example, when you have lots of objects with smaller fields 
"tucked away" someplace, with the external refcount handling overflows 
(that hardly happen in practice, so their inefficiency doesn't matter 
much).

>  Of course, it adds memory bandwidth costs as
> well

Compared to copying collectors and write barriers?

>  (you have to read/dec & read/inc refct fields for the two objects
> involved anytime you write an oop somewhere) which upsets caches and so
> on.

Not really.  With Foundation, you can skip a lot of that.

> If I remember right though, Dis/Inferno/whatever is suposed to be aimed
> at the embedded area and memory is definitely still a concern.

Maybe they can get away with a smaller refcount field as well, and 
maybe they also have a way of dealing with overflow that is precise, if 
they have overflow.

>  And it
> simply annoys me when a professionally published paper by people as
> experienced and well known as Rob Pike get something so basic wrong.

I don't see where it is wrong:

"Through reference-counted garbage collection, Dis reclaims memory the 
moment it becomes unused."

They did not claim that this applies to every possibly implementation 
of reference counting, just that Dis does it with their implementation 
of reference counting.

Marcel

-- 
Marcel Weiher				Metaobject Software Technologies
marcel at metaobject.com		www.metaobject.com
Metaprogramming for the Graphic Arts.   HOM, IDEAs, MetaAd etc.



More information about the Squeak-dev mailing list