GC.calloc
Daniel Murphy
yebblies at nospamgmail.com
Thu Jul 18 07:09:49 PDT 2013
"David" <d at dav1d.de> wrote in message news:ks8lcs$184p$1 at digitalmars.com...
> Am 18.07.2013 13:49, schrieb Daniel Murphy:
>> "David" <d at dav1d.de> wrote in message
>> news:ks6m33$o9b$1 at digitalmars.com...
>>> Why doesn't GC.calloc follow the function signature of stdc.calloc?
>>>
>>> calloc(num, size_per_element)
>>>
>>> I think this should be changed, if no reason speaks against it, I can
>>> look into changing this.
>>> Of course this will break backwards compatability, but I think this is
>>> worth it?
>>
>> YES. This is the memory corruption bug that I've been stuck on for the
>> last
>> week in the DDMD port.
>>
>> Thankyou so much for bringing this up, otherwise I'd still be stuck.
>>
>>
>
> Haha, glad I could help you! Looks like I am not the only one with this
> problem.
Then I found this:
import core.memory;
extern(C) int printf(const char *, ...);
void main()
{
auto data = cast(int*)GC.realloc(null, 1024 * 4);
printf("was %d\n", GC.sizeOf(data));
data = cast(int*)GC.realloc(data, 1025 * 4);
printf("is %d\n", GC.sizeOf(data));
}
prints:
was 4096
is 4096
Now I'm really worried.
More information about the Digitalmars-d
mailing list