"pause" garbage collection in parallel code
bearophile via Digitalmars-d
digitalmars-d at puremagic.com
Mon Dec 15 03:26:26 PST 2014
Stephan Schiffels:
> 2.) Is there a way to "pause" the GC collection for the
> parallel part of my program, deliberately accepting higher
> memory usage?
There are GC.disable and GC.enable.
> 3.) Most of the memory is used in one huge array, perhaps I
> should simply use malloc and free for that particular array to
> avoid the GC from running so often.
This is sometimes acceptable. For some usages there is also Array
in Phobos.
> I am a bit surprised that there is no command line option for
> dmd to control GC maximum heap size.
Adding such option could be a good idea.
> Who determines how often the GC is run?
The D GC is run when you allocate memory. If you don't allocate,
it's run only at program start to initialize it.
Bye,
bearophile
More information about the Digitalmars-d
mailing list