I have a plan.. I really DO

SrMordred patric.dexheimer at gmail.com
Tue Jul 10 16:07:01 UTC 2018


> As I've already repeated twice, this is not true in D. You 
> *can* predict precisely when the GC runs a collection cycle by 
> calling GC.disable and then calling GC.collect according to 
> *your* own schedule.  This is not just a theoretical thing.  I 
> have actually done this in my own projects, and it does work.

Sorry, can you help me with this?

Eg.
void doit()
{
     int[] x;
     x.length = 1024 * 1024 * 128;
}

void main()
{
     import core.memory : GC;
     import core.thread;
     GC.disable;

     doit; //alloc +- 500mb inside the func.
     Thread.sleep(5.seconds); //500mb still in use.
     GC.collect; //hmmm still there
     Thread.sleep(5.seconds); //same
}




More information about the Digitalmars-d-announce mailing list