From: Matthew Wilson (stlsoft_at_[hidden])
Date: 2003-11-18 06:11:06


"David B. Held" <dheld_at_[hidden]> wrote in message
news:bpc0dn$ge1$1_at_sea.gmane.org...
> "Matthew Wilson" <stlsoft_at_[hidden]> wrote in message
> news:bpbsa5$a5b$1_at_sea.gmane.org...
> >
> > "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.

I think we're 99% congruent on concept, and, so far, 20% congruent on
language. Given that, I'm happy to go with the above paragraph as an apt
description.