Coffeehouse Post

Single Post Permalink

View Thread: Patrick Dussud interview next week: Questions?
  • User profile image

    Minh wrote:
    I don't agree. The end-result for a GC.Collect is ALWAYS a less fragmented memory space. So there must be a penalty if they don't want us to do this all the time.

    If you can't deterministically run GC.Collect() as a game programmer, you're punished by a run-time that think it knows better.

    The penalty is that things would get pushed into older generations much earlier than they should and consequently are much more like to live longer and hog memory unnecessarily.

    Games programming requires a slight shift in mindset. You shouldn't ever get punished by the GC because you shouldn't really be doing any allocations during the critical path. It's all about reserving resources in advance and then reusing them efficiently.