General performance tip about possibly using the GC or not
Elronnd via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Aug 28 20:07:31 PDT 2017
On Tuesday, 29 August 2017 at 00:52:11 UTC, Cecil Ward wrote:
> I don't know when the GC actually gets a chance to run.
Another alternative that I *think* (maybe someone who knows a bit
more about the gc can chime in?) would work is if you manually
stopped the gc then ran collections when profiling shows that
your memory usage is high. To get GC functions, "import
core.memory". To stop the GC (put this at the top of main())
"GC.disable()". To trigger a collection, "GC.collect()". That
way you don't have to manually free everything, there's just one
line of code.
More information about the Digitalmars-d-learn
mailing list