I’m currently creating a tower defense game using C# & XNA. The games runs fine and smoothly for a while but after playing for a good amount of time (after sufficient enemies/towers/bullets have spawned) the game seems to slow exponentially. Even when all instances are cleared the lag still persists.
At first I thought this might have to do with garbage collection (and perhaps it does) but to test it I wrote destructors to print when an object was collected and everything looks fine (all objects are collected). So I’m curious if anyone has any experience with lag in XNA and the possible causes of it?
EDIT: This is for PC
There’s two things that I’ve used to check out performance.
1) App Hub has a Performance utility that you can use to help determine what youc an improve.
2) This is a bit old now, but for the Xbox 360 this document helped me a lot.
Update: also I forgot about this Gamefest 2010 presentation. It also goes over a few things.