https://issues.dlang.org/show_bug.cgi?id=20438
Issue ID: 20438 Summary: [Reg 2.086] GC: memory not reusable when calling GC.collect after GC.free Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: regression Priority: P1 Component: druntime Assignee: nob...@puremagic.com Reporter: r.sagita...@gmx.de Reported in the learn forum: This program shows increasing memory usage even though allocated memory is freed manually: version=FREE; version=COLLECT; import std.stdio; import core.memory; immutable int[] intZ = [1,2,3,4,4,6,6,8,8,65,8,23]; void main() { writeln(GC.stats); enum max = 100000; foreach (i; 0 .. max) { bool doprint = !(i % (max/10)); int[] z = intZ.dup; if (doprint) writef("%7d ", GC.stats.usedSize); version(FREE) GC.free(cast(void*) z.ptr); version(COLLECT) GC.collect(); if (doprint) writefln("%7d", GC.stats.usedSize); } } This doesn't happen when either version FREE or COLLECT is not defined. --