Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Boogle55

Evil memory problem

This topic is 5228 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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...

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
softice anyone?


If God played dice, He''d win.
—Ian Stewart, Does God Play Dice? The Mathematics of Chaos

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!