Tag Archives: memory

The Future of Computer Memory Architecture

So on Quora there is an author named Franklin Veaux.  He writes answers and comments on a lot of different topics and generally seems to have a good head on his shoulders and knows what he is talking about. One such topic that came up was the future of computer architectures with regard to system memory and offline storage.  Today’s modern computer systems utilize smaller amounts of primary RAM for system storage, which is fast but volatile; and larger amounts of persistent storage which is slow but is… well, persistent (via things like  removable discs, and magnetic rotational or solid state drives).

As we make advancements in memory technologies, it is conceivable that we will eventually end up with a memory technology that has the density of persistent storage, and the speed of volatile memory.   When this happens, the differentiation between system RAM and persistent storage may start to blur, or go away entirely.

Continue reading The Future of Computer Memory Architecture

XNA Audio Troubles…

So as I am adding sound effects to the game, I noticed that over time it would consume more and more memory and start to slow down. Another thing that would happen is that the audio would drag out and get sloooooooooooooooooow.

Now, I consider myself a pretty decent developer and I took steps to ensure that objects are reused where possible, instead of being new-ed up over and over again (.NET may be an environment that takes care of a lot of the dirty work of managing memory, but you still need to remember that it is a limited resource and code accordingly).

I should have taken the slowed sounds as a hint, but I went down the path of tracking objects and Garbage Collections to make sure that the object caches were healthy and the few objects that are destroyed and recreated are cleaned up in an orderly fashion as well.

After going though all that, I realized that the XACT-related classes are the culprits. If I turn off the sound, memory usage remains stable, even after running the game (in its attract mode) for more than 12 hours. It normally started to get slow after 45 minutes or so.

Looking up memory-related issues with audio in XNA, I read that other people have a similar problem, but only if they are not calling Update(…) in the Audio Engine during each frame. However, I AM calling Update(…) and am still having the problem. I even added additional calls to Update(…) from other locations in the code, but to no avail.

I even tried manually managing each Cue instance by storing them in a collection when they are played and then Dispose()-ing them when they are done playing. No difference.

I have temporarily resolved the issue by manually cleaning up and reallocating the Audio Engine at certain times during the game — between the end of a level and the start of a new one, and whenever the Title Screen transitions to the next screen when the game is in attract mode. Kludgy? Yep! But it works, and until an updated version of the XNA Framework is available that possibly fixes this bug, it will have to do.

Oh, and I used The GIMP to create a starburst graphic and am briefly displaying it as a “superluminal flash” (the warp equivlent of a sonic boom) when the player’s ship goes to warp. It looks sweet, even if I do say so myself! 🙂