Skip to main content
gamedev.net
🔒 Locked

Evil memory problem

Started by Boogle55 Jun 3, 2004 at 9:43 AM 4 replies 500+ views
Original Post
Boogle55
Boogle55
I have a very difficult to locate memory problem that after 2 days of searching I can''t locate at all. I''ve tracked it (possibly) down to the init process. It works fine in Debug, but not in any release builds (regardless of debug symbols). So a summary of what debug does to pointers/variables would be really helpful I would post some code, but really don''t know what to post - other than the entire project :s If anyone out there has a super-advanced uber debugger that eats these sorts of bugs for breakfast - or has experience + time I would REALLY appreciate your assistance. You can email me @ boogleoogle at hotmail dot com. I''ve littered breakpoints throughout the code, and can''t find where its going wrong at all. At one point I did notice a variable was fine before passed as an argument, but as soon as the line executed it was made corrupt - looked like a binary shift because "main.cfg" became "in.cfg". The ma wasn''t just replaced, more characters were in that area. I thought this was odd since it was just the passing operation that did this :s Would REALLY appreciate any assistance before I jump out a window...
Monder
Monder
Assuming you''re using C++ have a look at the memory manager here (near the bottom it''s called MMGR)

You can use it to track all allocations and deallocations in your program and it can give you an indication of when memory is corrupted. If you''ve got it tracking everything then it can make memory allocations and deallocations rather slow but the information it provides can be highly useful.

daveangel
daveangel
softice anyone?


If God played dice, He''d win.
—Ian Stewart, Does God Play Dice? The Mathematics of Chaos
If God played dice, He'd win.—Ian Stewart, Does God Play Dice? The Mathematics of Chaos
moucard
moucard
Maybe you could try running the project in a friend so you make sure you don''t have bad memory chips on your computer?
In my experience (it''s not much, but hey...):
maybe it''s something that you''ve overlooked and no matter how long you stare at the program you won''t see it. Try taking a break for a couple of days.

when you pin point the solution (or at least the part you feel is suspicious) try "taking it outside". This is my term for creating a smaller simpler project that just tackles the problem you have, out of the chaos of a large project with lots of source files.

Last word, since the variable is going corrupt, are you sure you don''t have an array that goes astray anywhere in there? Try looking at the base adressess of your variables and think if the adjacent variables have correct adressess according to the type size. For example, if you have a float and a short int that have a memory address of 0x000f348a and 0x000f348c respectively, then probably something is wrong (since a float takes 4 bytes of space).
Good luck man!
Boogle55
Boogle55
Thanks for the assistance so far Still haven''t located the bug though

Monder: I am using the memory manager you pointed out, sadly it sometimes works - sometimes doesn''t. When it does it seems to be fairly misleading in this case.

daveangel: Softice looks expensive

moucard: I''ll prolly take a break, its been getting pretty intense lately. I am thinking it could *possibly* be a memory chip issue (Windows has been getting less stable recently). I''ll put Visual Studio on another machine, and check it out there.

dmikesell: Thats what I was thinking. I have all warnings turned on, but my code is fairly robust because I usually heed those early on. I remember reading your article a while back and promptly changed styles to suite. STL is now featured very heavily - in fact it was changing to STLport that originally demonstrated this error. Now I''m switching between the two STL implementations (VS.NET & STLport) - both giving different errors

Topic Locked

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

Sign in to reply to this topic.