Reduce, Reuse, Recycle
If you've played my game from the first TOJam, you will have probably noticed how it gets slower and slower as play progresses. For my first foray into .NET game development, I had developed the most absurd entity management system and relied on the garbage collector to take care of matters.
Big freakin' mistake.
Every frame, the entity manager was called on to update each game entity — not all that troublesome, really. But what was trouble was the call to System.GC.Collect() almost every frame, as the entity manager dealt with cleaning out entities no longer in use by the game. And given how new entities were created quite often as well, you can just imagine the churn in memory.
I'm starting work on another article, this one on reducing memory churn by reusing objects and lessening the recycling of memory via the garbage collector. While primarily pegged at XNA game development, it should be useful for anyone dealing with frequent object creation and deletion in the .NET environment. Currently I'm in the research stage, and main writing should be started by next week.
- Chris Charabaruk's blog
- Login or register to post comments
Delicious
Digg
StumbleUpon
Reddit
Facebook
Technorati




