Acceptable GC frequency for a SlimDX/Windows/.NET game?
Posted
by
Rei Miyasaka
on Game Development
See other posts from Game Development
or by Rei Miyasaka
Published on 2012-06-25T13:32:22Z
Indexed on
2012/06/25
15:23 UTC
Read the original article
Hit count: 334
.NET
|memory-efficiency
I understand that the Windows GC is much better than the Xbox/WP7 GC, being that it's generational and multithreaded -- so I don't need to worry quite as much about avoiding memory allocation.
SlimDX even has some unavoidable functions that generate some amount of garbage (specifically, MapSubresource creates DataBoxes), yet people don't seem to be too upset about it.
I'd like to use some functional paradigms to write my code too, which also means creating objects like closures and monads.
I know premature optimization isn't a good thing, but are there rules of thumb or metrics that I can follow to know whether I need to cut down on allocations? Is, say, one gen 0 GC per frame too much?
One thing that has me stumped is object promotions. Gen 0 GCs will supposedly finish within a millisecond or two, but if I'm understanding correctly, it's the gen 1 and 2 promotions that start to hurt. I'm not too sure how I can predict/prevent these.
© Game Development or respective owner