what to do if debug runs fine, but release crashes(如果调试运行良好,但发布崩溃怎么办)
问题描述
我有一个在调试版本中运行良好的应用程序,但是当我在发布版本中启动它时,我得到了一个
I have an application that runs just fine in the debug build, but when I start it in the release build, I get a
unhandled Exception at 0x0043b134 in myapp.exe: 0xC0000005:
Access violation while reading at position 0x004bd96c
如果我点击break",它会告诉我没有加载任何符号并且无法显示源代码.
If I click on 'break' it tells me that there are no symbols loaded and the source code can't be displayed.
在这种情况下我可以做些什么来追查问题?
What can I do in such a situation to track down the problem?
推荐答案
这类问题往往是由于单元化变量造成的.我会从那里开始寻找你的问题.
This kind of problem is often due to unitialized variables. I'd start there looking for your problem.
调试模式更宽容,因为它通常被配置为初始化尚未显式初始化的变量.
Debug mode is more forgiving because it is often configured to initialize variables that have not been explicitly initialized.
也许您正在删除一个未初始化的指针.在调试模式下它可以工作,因为指针被清空并且删除 ptr 将在 NULL 上正常.发布时有点垃圾,然后删除ptr实际上会导致问题.
Perhaps you're deleting an unitialized pointer. In debug mode it works because pointer was nulled and delete ptr will be ok on NULL. On release it's some rubbish, then delete ptr will actually cause a problem.
这篇关于如果调试运行良好,但发布崩溃怎么办的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如果调试运行良好,但发布崩溃怎么办
基础教程推荐
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 初始化列表*参数*评估顺序 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- CString 到 char* 2021-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
