Visual studio 2008 release build : application crashes on basic string or basic pointer operations
I have a application compiled in Visual studio 2008,which runs fine in debug build. In release build , the application crashes when std开发者_Python百科::wstring assignment is done or when shared pointer is accessed. Any idea why this happens in release build. crash at : eg: m_name = name; //m_name and name are of type std::wstring
In debug mode, some compilers will set values of pointers to default values (like null) for example. But in release mode the value of the pointer will be whatever is on the stack at that location and will be pointing to an invalid object thus resulting in a crash.
Your problem is probably a memory corruption caused by some other part of your program. Double check that your bounds checks are correct everywhere, you can also use specialized tools like Memory Validator or Bounds Checker.
精彩评论