Hi,
I'm running this piece of code, but the memory isn't getting freed (as judging
from Task Manager). It doesn't help if I call collect() and minimize() in a
loop... is something wrong? Or is Task Manager not a reliable indicator of this?
Thank you!
import std.stdio;
import core.memory;
import core.thread;
void writelnflush(T...)(T args) { writeln(args); stdout.flush(); }
void allocate() { new byte[1024 * 1024 * 64]; }
void main()
{
writelnflush("Sleeping (check the memory usage!)...");
Thread.sleep(4 * 10000000);
writelnflush("Allocating...");
allocate();
writelnflush("Collecting...");
GC.collect();
GC.minimize();
writelnflush("Sleeping (check the memory usage!)...");
Thread.sleep(4 * 10000000);
}