Archived

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

Memory Problem

This topic is 5671 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

When I run my programs on school computers, I consistently get memory errors: "The instruction at "0x004060ca" referenced memory at "0x33633464". The memory could not be "read" This problem usually crops up when I''m doing stuff with pointers or STL iterators. I can usually fix it, but I always do it by accident. Does anyone know what''s going on here?

Share this post


Link to post
Share on other sites
STL does not have error checking and that''s why sometimes these problems come up unknowingly. This is not neccessarily bad though as it comes with speed incentives.

Anyway you are accessing memory that''s not supposed to be there. Probably been freed. For example, you might have a vector of size ten but you are accessing it at index 20.

Share this post


Link to post
Share on other sites
quote:
Original post by Darkor
STL does not have error checking

What STL implementation are you referring to? STLport, for instance, seems to have very good error checking.

Forcas: use the call stack (Alt-7) to see which function produced the exception. Then use watch (Alt-3) and variables (Alt-4) windows to examine the values of your variables.

Share this post


Link to post
Share on other sites
If it''s happening at school, but not at home, I''m going to guess your problem isn''t STL, but that the school computers aren''t running the latest patches / service packs. Just guessing that it''s an older version of MFC or ATL and you''re inserting a bad pointer into your STL containers, so you''re getting a bad pointer back out.

Share this post


Link to post
Share on other sites