How to release memory? (D2.0.30)

AxelS a_bothe at gmx.net
Sat Jul 4 04:17:28 PDT 2009


@Ary Borenszweig: Good idea but I can't pipe data to a HTTP-server located somewhere in the internet...


OK, I tried it with C's malloc and free - but everytime I access my array, D puts the memory into its heap...I'm getting crazy because of this!

ubyte[] data=cast(ubyte[])malloc(50_000_000)[0 .. 50_000_000];

foreach(ref d;data)
{
   d=4; // Simulate data access
}

free(data.ptr);

Can't the D compiler handle such problems in future versions?
Of course it's right to release unused memory...but not just release it into the program-internal heap...


More information about the Digitalmars-d-learn mailing list