Less known std.gc
Jarrett Billingsley
kb3ctd2 at yahoo.com
Mon Nov 19 08:43:19 PST 2007
"Christopher Wright" <dhasenan at gmail.com> wrote in message
news:fhs891$277v$1 at digitalmars.com...
> There's nothing in any of that that allows you to allocate memory and then
> say, "Let the garbage collector handle this from now on." I guess I have
> to start writing code to delete the objects that I malloc'd; I have an
> embarrassing amount of memory leaks now.
Oh yes there is :) std.gc.alloc, std.gc.realloc, and std.gc.extend all
allow you to allocate arbitrary blocks of GC'ed memory. Also if you
allocate memory with alloc (and possibly realloc?) you can flag the block as
containing or not containing pointers using std.gc.hasPointers(ptr) and
std.gc.hasNoPointers(ptr).
More information about the Digitalmars-d-learn
mailing list