How disruptive is the GC?
via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Aug 2 03:46:06 PDT 2015
On Wednesday, 29 July 2015 at 09:25:50 UTC, Snape wrote:
> I'm in the early stages of building a little game with OpenGL
> (in D) and I just want to know the facts about the GC before I
> decide to either use it or work around it. Lots of people have
> said lots of things about it, but some of that information is
> old, so as of today, what effect does the GC have on the smooth
> operation of a real-time application? Is it pretty noticeable
> with any use of the GC or only if you're deallocating large
> chunks at a time?
I'd like to add that you can tell the runtime (and therefore the
GC) to ignore a thread:
http://dlang.org/phobos/core_thread.html#.thread_detachThis
This allows you to implement real-time tasks in that thread, and
it will never be interrupted by the GC. You can still use the GC
in other threads. Of course, you need to make sure not to call
into the GC from the detached thread (easy by using @nogc), and
to keep at least one reference to GC data used in the detached
thread in a normal thread.
More information about the Digitalmars-d-learn
mailing list