Advertisement

Memory Corruption: OMG Panic attack!

Started by January 21, 2012 11:47 PM
10 comments, last by Bacterius 12 years, 9 months ago

[quote name='Koobazaur' timestamp='1327302135' post='4905355']
Memory breakpoints! It's one of those features of VS you never really use, but when you do use it, you thank god it exists!

As for my funky stories, In my current game I suddenly encountered a bug where, after about 10 seconds, the main ambient light would start to flicker for a second or two, before completely going dark. And then, the gravity would invert.

Which is peculiar, considering ambient light calculation is hardcoded into the shader at the time, and we had no way of modifying gravity on the fly...


Depending on the game, I would consider fixing a bug like that, and then re-implementing the 'features' as part of the game play.
[/quote]
I was thinking the same!!! That bug is really cool.

I use memory breakpoints very often. Not just for memory corruption, but also when I accidentally overwrite some value/behavior (due to wrong code path, not memory corruption) it's faster and easier than searching through the code where you manipulate that variable.

Put the variable name in MSVC's QuickWatch and add the '&' prefix. It will tell you the memory address. Copy pasting is allowed which means setting up a data/memory breakpoint is very straightforward.

Going back to the mem. corruption issue, yes they ease the pain; but there are some cases where they just aren't enough.

@Hodgman: Wow. Just wow. Speechless.
Something really confusing happened to me once. I had a piece of code that didn't work. Eventually I randomly decided to put a printf("test") somewhere in the middle.

...

It worked perfectly blink.png

Turns out the printf call prevented a memory corruption from occurring a few lines later somehow.

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

This topic is closed to new replies.

Advertisement