GC.BlkAttr.FINALIZE

Namespace rswhite4 at googlemail.com
Fri Feb 28 15:24:51 PST 2014


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.


More information about the Digitalmars-d-learn mailing list