From: David B. Held (dheld_at_[hidden])
Date: 2003-11-17 21:33:18
"Matthew Wilson" <stlsoft_at_[hidden]> wrote in message
> "David B. Held" <dheld_at_[hidden]> wrote in message
> > [...]
> > Just out of curiosity, how else do you implement an external
> > count?
> In a shared-pool of counters. That's what the last (#5) of the
> ptr-types examined does.
> The one I've done is a very brain-dead thing, that just has
> 1024 longs in an array. The (thread-safe) pool class simply
> allocates them in turn and maintains a count of the number
> allocated. Once it's 1024, all subsequent counters are
> allocated from the heap. Only when all counters are returned
> does the pool allocate from the array again.
But this scheme is even more elaborate than just allocating
from the heap initially, and could simply be viewed as an
optimization scheme for direct heap allocation. I guess I'm
just not getting what is suprising about allocating an external
count on the heap to begin with. It seems to me that external
counting is the insight, and not how it's implemented. But
maybe that's just hindsight getting in the way.
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.538 / Virus Database: 333 - Release Date: 11/10/2003
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk