Should GC.realloc(null, N) be the equivalent of GC.calloc or GC.malloc?
safety0ff via Digitalmars-d
digitalmars-d at puremagic.com
Thu Jul 17 18:36:11 PDT 2014
On Thursday, 17 July 2014 at 23:51:03 UTC, Ali Çehreli wrote:
>
> However, this side question that need not be answered remains:
> If I started with GC.calloc, shouldn't GC.realloc give me
> memory that is cleared?
No, the GC doesn't track whether the memory was calloc'ed.
> Or at least don't I deserve a GC.recalloc()?
>
The only reasonable way to implement this would be to have calloc
always zero the over-allocation.
It's also worth noting that there's no reqalloc, so any user
implementation of recalloc will have to grab the gc lock twice.
More information about the Digitalmars-d
mailing list