GC.calloc(), then what?
Sean Kelly via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Jun 27 16:07:32 PDT 2014
On Friday, 27 June 2014 at 07:34:55 UTC, safety0ff wrote:
> On Friday, 27 June 2014 at 07:03:28 UTC, Ali Çehreli wrote:
>> 1) After allocating memory by GC.calloc() to place objects on
>> it, what else should one do?
>
> Use std.conv.emplace.
And possibly set BlkInfo flags to indicate whether the block has
pointers, and the finalize flag to indicate that it's an object.
I'd look at _d_newclass in Druntime/src/rt/lifetime.d for the
specifics.
To be honest, I think the GC interface is horribly outdated, but
my proposal for a redesign (first in 2010, then again in 2012 and
once again in 2013) never gained traction. In short, what I'd
really like to have is a way to tell the GC to allocate an object
of type T. Perhaps Andrei's allocators will sort this out and
the issue will be moot. For reference:
http://lists.puremagic.com/pipermail/d-runtime/2010-August/000075.html
http://lists.puremagic.com/pipermail/d-runtime/2012-April/001095.html
http://lists.puremagic.com/pipermail/d-runtime/2013-July/001840.html
More information about the Digitalmars-d-learn
mailing list