Skip to main content
gamedev.net
🔒 Locked

detecting memory "bleeding"

Started by Damocles 3 replies 950+ views
Original Post
Damocles
Damocles
I have a really irritating problem. In my game, I have a pointer to an object, but somewhere along the line, the pointer is getting modified and is no longer pointing to the correct location, making fatal exception errors. I've thoroughly checked the code and there are no times where the pointer is modified other than at creation and deletion, and it works fine for several minutes before getting screwed. This means that somewhere, some other bit of code is writing to memory it shouldn't be. So what I need is some way to monitor the pointer/variable in question to see when it gets modified. Is there anything (preferrably in VS6) that can do this?
------------------------------------------[New Delta Games] | [Sliders]
ZQJ
ZQJ
Well, yes, it can be done, but I don't have VS6 handy so I can't check how exactly. x86 supports (I think it's 4) memory breakpoints, where you give it a memory address and it monitors that address for any changes. In gdb it's done using watch expr. You can also do it from within your program using Windows debugging functions, dig in MSDN to find out about that.
Damocles
Damocles
Thanks for the link Nitage - that seems like what I need. I haven't found the culprit yet, but at least I think I'm on the right track now.
------------------------------------------[New Delta Games] | [Sliders]
iMalc
iMalc
Good luck finding the problem. Be sure to start making good use of assert()'s too, in order to prevent some types of bugs in future. In particular, use them to at least check preconditions, and that array accesses are within bounds.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.