|
Boost : |
From: scleary_at_[hidden]
Date: 2000-11-17 13:35:10
I'd like to request a formal review for the Pool library. A recently
updated version of Pool is in the files section.
A Short Description For Those Saying "What Is Pool?":
Pool is a small collection of classes which provide fast allocation and
deallocation of fixed-size memory chunks. It is both a space and time
improvement over malloc() and new, especially for small chunks. (It
achieves this by sacrificing generality -- a Pool may only be asked for
chunks of a single fixed size).
Pool provides a basic interface (sized_pool), an interface that includes
garbage collection (pool), and two interfaces that satisfy Standard
Allocator requirements (pool_allocator and fast_pool_allocator).
Pool is 100% portable. The Allocator interfaces are also thread-safe, if
there is only one thread running before main() begins and after main() ends.
One of the possible future uses of Pool is in the shared_ptr class of the
Smart Pointers library, where small objects (longs) must be created on the
heap.
-Steve
P.S. Pool still includes a number of headers that will hopefully be absorbed
into other libraries. For now, they only contain enough code to let Pool
work. These are (with future libraries designated by "(?)"):
ct_gcd_lcm.h - compile-time algorithms library (?)
guard.h, mutex.h - multi-threaded synchronization library (?)
postulate.h - Static Asserts Library
singleton.h - singletons library (?)
P.P.S. John - you had some concerns some time ago about using a pool
allocator in a file-scope template object; I think this version of Pool will
work for that, but would you check it to see if I missed anything? I used a
convoluted method described in "singleton.h" instead of the
reference-counted singleton solution you suggested.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk