Sponsored By

Feature: 'Debugging Memory Corruption in Game Development'

In an <a href="http://www.gamasutra.com/view/feature/3818/debugging_memory_corruption_in_.php">in-depth technical article</a>, Neversoft co-founder Mick West discusses memory corruption in games, pinpointing the symptoms, causes, effects, and solutions fo

Eric Caoili, Blogger

October 16, 2008

2 Min Read

In an in-depth technical article, Neversoft co-founder Mick West discusses memory corruption in games, pinpointing the symptoms, causes, effects, and solutions for many game glitches and crashes. One symptom of memory corruption is finding unexpected values in a variable that typically has values within a certain expected range: "Wildly unusual values often have noticeable effects, such as the player teleporting to the end of the universe, or a model being scaled infinitely large. Less severe corruptions can occur, for example, a counter might simply be reset to zero or even just changed slightly. This type of corruption can be difficult to track down, as it may not produce especially noticeable effects. Here a good testing department is invaluable. If the testers can notice little inconsistencies like this, then you will catch potentially harmful bugs at a much earlier stage. Since the location of the corruption of memory is often somewhat random, then the problem may go undetected for some time. This may give the false impression that the existing code is solid. Upon adding new code or data, the bug may reveal itself, causing you to think that the new code has caused the bug, when in fact the new code has only cause memory to be slightly re-ordered into a configuration that reveals a pre-existing bug." Because memory often contains graphical data, corrupted memory can also result in corrupted graphics, manifesting in meshes, skeletons and animations, and textures. Here are just a few of the listed symptoms and causes with corruption in textures: "Corruption in a texture that resembles a squashed or discolored version of another texture indicates that you might be overwriting the texture with another one of different dimensions or different bit depth. If the corruption is static (unchanging), then it indicates a one-time event, where a pointer was misused just once. The corruption happened, and the game went along on its way. In this case, you need to try to track down what triggered that event. Testers need to try to find a way of duplicating the circumstances that lead to the visual corruption. Video of the game is very useful in this case. If the corruption appears to be animating, if the corrupt section is flickering, or if the banded area is flashing on and off, then you have some ongoing corruption. If the game remains in this state, it should make it easier to debug." You can read the full feature on memory corruption in games, which lists more symptoms of memory corruption and also includes tips investigating the causes and effects of corruption (no registration required, please feel free to link to this feature from other websites).

About the Author(s)

Eric Caoili

Blogger

Eric Caoili currently serves as a news editor for Gamasutra, and has helmed numerous other UBM Techweb Game Network sites all now long-dead, including GameSetWatch. He is also co-editor for beloved handheld gaming blog Tiny Cartridge, and has contributed to Joystiq, Winamp, GamePro, and 4 Color Rebellion.

Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like