Garbage generation

Topics: Developer Forum
May 23, 2008 at 10:06 AM
Hello, long time no post...

I have been beavering away on my game, and I was doing some performance monitoring, and as far as I can tell the line
ContactList.Sort(contactComparer) is generating garbage.

I just wondered if this was a known issue. (or even if it is a real issue).

Cheers all.

J.
May 27, 2008 at 3:34 PM
ContactList is simply an extension of the generic list, so I doubt there is much more garbage generated than an iterator here or there. My guess is that the IComparer you are passing in to the sort call is generating most of the garbage - what does it look like?

As for whether it matters, I guess that depends on how often you are sorting. If you sort every frame then it will start to matter, especially on the 360 where GC is not so smrt.