On Monday, 15 December 2014 at 11:54:44 UTC, Daniel Murphy wrote:
"Stephan Schiffels" wrote in message news:wjeozpnitvhtxrkhu...@forum.dlang.org...

I see several ways how to improve my code:
1.) Is there a way to tell the GC the maximum heap size allowed before it initiates a collection cycle? Cranking that up would cause fewer collection cycles and hence spend more time in my multithreaded code?

Yes, sort of. You can use http://dlang.org/phobos/core_memory.html#.GC.reserve to have the GC grab a big chunk of memory, and collections won't run until that is exhausted. As it is only allocating virtual memory, it should be more or less equivalent to setting the max heap size.


This doesn't work for me, for some reason. I reserve via GC.reserve(4_000_000_000), ensured that it does return at least that amount, but the Garbage collector will still collect like crazy, long before that reserved memory is exhausted...

Reply via email to