Boost logo

Boost :

From: shiwei xu (xushiweizh_at_[hidden])
Date: 2008-05-07 03:16:34


Hello all,

I update GC Allocator specification now. See the example named
"testExceptionSemantics".

The following is the new minimum specification for GC Allocator:

typedef void (*DestructorType)(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, DestructorType 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, DestructorType 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);
};

See http://svn.boost.org/trac/boost/ticket/1879#comment:13

Thank Steven Watanabe and Scott McMurray.

On Wed, May 7, 2008 at 11:10 AM, Steven Watanabe <watanabesj_at_[hidden]>
wrote:

> This is not in accord with normal C++ semantics.
> It is the responsibility of the constructor to make sure that if it
> fails, it cleans up any resources that it allocated.
>
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk