Re: [boost] request for interest in a garbage collection library

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

Kasra wrote:
One of the advertised advantages was that is was written purely in standard C++, which isn't the case of Boehm which isn't portable.
auto_ptr<char*> traced_buffer(new (gc_traced) char[1024]);
This raises undefined behaviour, I believe.

"Kasra" <kasra_n500@yahoo.com> wrote in message news:794765.62156.qm@web110015.mail.gq1.yahoo.com...
Here is a list of issues with Boehm GC: 1) the default C++ interface does not play well with C++ (as Boehm says here: http://www.hpl.hp.com/personal/Hans_Boehm/gc/gcinterface.html). 2) in order to have GC'd threads, you need to replace native thread creation calls with Boehm GC thread creation calls. This means the Boehm GC library can not be used with third-party libraries that contain a threading API on top of native threads. 3) if you allocate data before calling GC_INIT() (for example, when initializing global variables), then they might not be collected. This is platform-specific, i.e. it works with some platforms, it does not work with some other platforms. 4) it's not clear what happens with allocations from DLLs. This library is not better than Boehm's gc (certainly slower than Boehm's), but it is portable C++.
participants (3)
-
Achilleas Margaritis
-
Kasra
-
Mathias Gaunard