GC behavior
Gregor Mückl
gregormueckl at gmx.de
Fri Jun 7 12:28:50 UTC 2019
Hi!
I'm not 100% sure if I'm in the right here, but I believe that
the following program shouldn't have unbounded heap growth to the
point where it runs out of memory:
module gctest;
import core.memory;
import core.thread;
void main()
{
for(int i = 0; i < 10000; i++) {
int[] x = new int[10000000];
Thread.sleep(dur!"msecs"(200));
//GC.collect(); // keeps program from failing
}
}
If GC.collect() is called constantly, heap size stays pretty much
constant. Tested only on Windows 10 (64 bit) with DMD 2.086.0 so
far. I'd say that this behavior is a bug.
More information about the Digitalmars-d
mailing list