Is it my misunderstanding or does FINALIZE not work?

----
import std.stdio;
import core.memory : GC;

void main() {
        int id = 2;

        struct Foo {
                ~this() {
                        id--;
                        writeln("DTor");
                }
        }

Foo* fs = cast(Foo*) GC.malloc(2 * Foo.sizeof, GC.BlkAttr.FINALIZE);

        writeln("end of main: ", id);
}
----

id is still 2. I know that the GC is incapable with arrays of structs but if FINALIZE means the same thing I expect, it should work. Otherwise the docs should be updated.

Reply via email to