What is new?
1. Lock-free free list (workarounds ABA problem).
2. Provide both region allocators (boost::auto_alloc, boost::scoped_alloc) and general-purpose allocators (boost::gc_alloc).
3. Notes: To fit for C++ exception semantics (See the example named "testExceptionSemantics"), I updated the specification of GC Allocator.
Highlights
1. Allocating memory is very fast.
2. No memory leaks. No need to delete objects manually. Or forgetting to delete objects is allowed.
Thanks
- Steven Watanabe
- Scott McMurray
- Tim
- Diduck, Lance
Source code
1. Svn checkout http://winx.googlecode.com/svn/tags/boost-memory-0.2.00/.
2. Svn checkout http://svn.boost.org/svn/boost/sandbox/memory/.
What is boost-memory?
It provides allocators named "GC Allocator". Note "GC Allocator" isn't GC.
GC Allocator is different from STL Allocator. The following is minimum specification for GC Allocator:
typedef void (*destructor_t)(void* data); concept GCAllocator { // Allocate memory without given a cleanup function void* allocate(size_t cb); // Allocate unmanaged memory with a cleanup function void* unmanaged_alloc(size_t cb, destructor_t fn); // Commit unmanaged memory to be managed. void* manage(void* p, destructor_t fn); // Deprecated: allocate memory with a cleanup function void* allocate(size_t cb, destructor_t fn) { return manage(unmanaged_alloc(cb, fn), fn); } // Cleanup and deallocate all allocated memory by this GC Allocator void clear(); // Swap two GCAllocator instances void swap(GCAllocator& o); };
For more information about GC Allocator, refer to http://www.codeproject.com/KB/cpp/gc-allocator.aspx





