Boost logo

Boost :

From: Gregory Colvin (gregory.colvin_at_[hidden])
Date: 2003-05-29 21:20:02


Check out

    http://www.hpl.hp.com/personal/Hans_Boehm/gc/gcinterface.html

which provides a gc_alloc, and for new(gc) all you need is something
like this:

    struct gc_t {};
    static const gc_t gc;

    void* operator new (size_t n, const gc_t&) { return GC_malloc(n); }
    void* operator new[](size_t n, const gc_t&) { return GC_malloc(n); }

    void operator delete (void* ptr, const gc_t&) {}
    void operator delete[](void* ptr, const gc_t&) {}

Much easier than hacking shared_ptr.

On Thursday, May 29, 2003, at 19:57 America/Denver, Larry Evans wrote:
> Gregory Colvin wrote:
>
> [snip]
>
> > It is not that hard to write a new(gc) and gc_allocator
> > using Boehm's collector, for those who don't want to have
> > the collector take over all memory allocation.
>
> I found John Max Skaller's posts on such a gc_allocator:
>
> http://aspn.activestate.com/ASPN/Mail/Message/boost/1150154
>
> Since I still can't figure out how he did it, maybe he could provide
> code or more details on howto. However, I don't know his email. I
> may just download his Felix compiler and try deciphering the code.
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost


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