[Issue 20438] [Reg 2.086] GC: memory not reusable when calling GC.collect after GC.free

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Dec 7 20:19:42 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=20438

--- Comment #1 from Rainer Schuetze <r.sagitario at gmx.de> ---
Reduced:

import core.stdc.stdio;
import core.memory;

void main()
{
    printf("1: %lld\n", cast(ulong)GC.stats.usedSize);
    void* z = GC.malloc(100);
    printf("2: %lld\n", cast(ulong)GC.stats.usedSize);
    GC.free(z);
    printf("3: %lld\n", cast(ulong)GC.stats.usedSize);
    GC.collect();
    printf("4: %lld\n", cast(ulong)GC.stats.usedSize);
}

shows:
1: 16
2: 144
3: 16
4: 4096

--


More information about the Digitalmars-d-bugs mailing list