How disruptive is the GC?

Rikki Cattermole via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jul 29 02:33:21 PDT 2015


On 29/07/2015 9:25 p.m., 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?

Some tips:
- Avoid allocations if possible
- Use buffers/preallocated memory if possible
- Disable the GC (collection only)
- Use allocators instead of e.g. new
- -vgc is awesome

If you are using GC to allocate (not really a good idea), run collect 
when you have some spare cycles.

Can't really say much about the current GC implementation. But what I do 
know is for real time apps GC is not a good tool for memory management.


More information about the Digitalmars-d-learn mailing list