Boost logo

Boost :

Subject: Re: [boost] request for interest in a garbage collection library
From: Kasra (kasra_n500_at_[hidden])
Date: 2009-04-22 14:31:15


I have interest in garbage collection. However, I have few questions about this library.

* How is it going to be better than The Boehm GC?
* Why isn't it a wrapper for Bohem?

This header is what is used within our organisation for GC
memory management.

[C++ =============================================== C++]

#ifndef __GC__
#define __GC__

#define GC_NOT_DLL
#include <bohem/gc.h>
#include <bohem/gc_allocator.h>
#undef GC_NOT_DLL

#ifdef BOOST_MSVC
# pragma comment(lib, "gc.lib")
#endif

namespace {
using gc_allocator;
using gc_traceable;

extern const struct gc_memory_t { } gc;
extern const struct gc_traceable_t { } gc_traced;

inline void* operator new(size_t size, const gc_memory_t&) throw(bad_alloc);
inline void* operator new[](size_t size, const gc_memory_t&) throw(bad_alloc);
inline void operator delete(void* memory, const gc_memory_t&) throw(bad_alloc);
inline void operator delete[](void* memory, const gc_memory_t&) throw(bad_alloc);

inline void* operator new(size_t size, const nothrow_t&, const gc_memory_t&) throw();
inline void* operator new[](size_t size, const nothrow_t&, const gc_memory_t&) throw();
inline void operator delete(void* memory, const nothrow_t&, const gc_memory_t&) throw();
inline void operator delete[](void* memory, const nothrow_t&, const gc_memory_t&) throw();

inline void* operator new(size_t size, const gc_traceable_t&) throw(bad_alloc);
inline void* operator new[](size_t size, const gc_traceable_t&) throw(bad_alloc);
inline void operator delete(void* memory, const gc_traceable_t&) throw(bad_alloc);
inline void operator delete[](void* memory, const gc_traceable_t&) throw(bad_alloc);

inline void* operator new(size_t size, const nothrow_t&, const gc_traceable_t&) throw();
inline void* operator new[](size_t size, const nothrow_t&, const gc_traceable_t&) throw();
inline void operator delete(void* memory, const nothrow_t&, const gc_traceable_t&) throw();
inline void operator delete[](void* memory, const nothrow_t&, const gc_traceable_t&) throw();

}

#endif /* __GC__ */

[C++ =============================================== C++]

[example

auto_ptr<char*> gc_buffer(new (gc) char[1024]);

auto_ptr<char*> traced_buffer(new (gc_traced) char[1024]);

example]

-- Kasra

      


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