D's New GC and Object Allocation Pools
Andrei Alexandrescu via Digitalmars-d
digitalmars-d at puremagic.com
Tue Oct 28 10:24:05 PDT 2014
On 10/25/14 8:37 PM, Maxime Chevalier-Boisvert wrote:
> Hello,
>
> I was wondering if there have been updates regarding Andrei's
> announcement that he would rewrite the D garbage collector. Is there any
> kind of timeline for when a new version of the GC can be expected?
There is no timeline as of now. I'd need a good contiguous hunk of time
to dedicate to this, and the opportunity hasn't shown itself so far. But
I am optimistic I'll have the opportunity in the near future.
You should also know about the experimental Sociomantic GC for D2 which
has been recently announced: http://goo.gl/lOvttC
> I also wanted to ask if there was an implementation of an object pool in
> the standard library. If not, I'm wondering what the best way to
> implement this is. Is there any way to overload new and destroy?
>
> I was thinking of using the templated emplace operator from std.conv to
> allocate class objects into a large flat array, and to derive
> pool-allocated classes from a PoolObject base class. This base class
> would contain linked list pointers to implement a free list, as well as
> templated static methods to allocate and free the objects. Any advice
> welcome.
My allocator (which has been mentioned) is a low-level backend for such
stuff. It's of good quality (i.e. fast) but very primitive in the sense
it has no porcelain on it - you need to instantiate the desired
combination yourself, call directly methods such as allocate() and
deallocate(), and traffic in void[].
Andrei
More information about the Digitalmars-d
mailing list