Hi
I'm in trouble with unexplainable fps drops. FPS drops 60->29 every 2-3 minutes. I'm using single SpriteBatch and use single texture draw but fps still drops.
Thanks for any help.
Hi
I'm in trouble with unexplainable fps drops. FPS drops 60->29 every 2-3 minutes. I'm using single SpriteBatch and use single texture draw but fps still drops.
Thanks for any help.
It’s the GC. Is it every 2, 3 or 4 minutes?
See if you allocate anything during the game loop.
Things to look for: the ‘new’ keyword, string manipulations, number to string conversion, enumerators, foreach loops.
Thank you nkast. Is there any sample for the best practice?. Because every game has foreach loops or new keywords.
I sugest to use for(; instead of foreach() whenever you are not sure if the enumerator generates garbage. Also, remove Linq. Best practice is to run a profiler every now and them to spot where you allocate new objects in your game loop.
You souldn’t use the ‘new’ or any of the things above in the game loop. Instead pre-allocate everything in advance, use pooling , etc
The GC is triggered every 1MBytes of allocations or so and then you will see frame drops.
http://blogs.msdn.com/b/shawnhar/archive/2007/07/02/twin-paths-to-garbage-collector-nirvana.aspx
Woow thank you very much.