Memory Problem
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?
This is usually a bad pointer, or iterator. Check in the debugger what the pointer is you are using. Check it it is actually pointing to what you think it is pointing to.
Cheers,
Nick
Cheers,
Nick
What is a "bad" pointer? I never get memory errors on my computer at home. Hmm... maybe I''ll have to try and figure out exactly what causes this.
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.
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.
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement