Boost logo

Boost :

From: Philippe A. Bouchard (philippeb_at_[hidden])
Date: 2003-11-18 15:11:32

David B. Held wrote:


>>> 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.

A shared-pool could of course accelerate your server... but maintenance is

My 2¢,


Boost list run by bdawes at, gregod at, cpdaniel at, john at