Windows has triggered a breakpoint in...... 的问题

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Windows has triggered a breakpoint in...... 的问题相关的知识,希望对你有一定的参考价值。

调试代码时遇到类似如下的问题:


Windows has triggered a breakpoint in .exe.
This may be due to a corruption of the heap, which indicates a bug in .exe or any of the DLLs it has loaded.

This may also be due to the user pressing F12 while .exe has focus.
The output window may have more diagnostic information


看到这样的错误可以断定是堆内存使用错了,可能是申请的堆内存没有释放、内存使用越界或使用了一段已经被销毁的内存。

如下代码:

......

BufferL     buffer;

size_t      buffer_len;

size_t      src_buffer_len = motivation.data_len;

buffer_len = src_buffer_len;

buffer.resize( src_buffer_len  );

SRes ret = LzmaCompress( &buffer[sizeof(xxx)], &buffer_len, &src_buffers[0], src_buffer_len, outProps, &outPropsSize  );


首先给buffer 的size是src_buffer_len 的长度,即为src_buffers的长度。src_buffers压缩后的长度为buffer_len,如果buffer_len > src_buffer_len的话,那么压缩的时候将出现赋值越界的问题,因为接收数据的buffer长度为src_buffer_len。这样就有可能出现 “Windows has triggered a breakpoint ”的问题,可能在赋值越界时不会立即出现此问题,但是这个问题是迟早会出现的。

    所以说,良好的编码习惯很重要。

网上有人推荐pageheap.exe 来检查内存越界的问题。具体请查阅:

http://c.360webcache.com/c?m=fc2dda77b80c762a85d8be5548bf19f1&q=windows+has+triggered+a+breakpoint&u=http%3A%2F%2Fwww.xuebuyuan.com%2F759315.html,


以上,2017.03.02

本文出自 “技术知识梳理” 博客,转载请与作者联系!

以上是关于Windows has triggered a breakpoint in...... 的问题的主要内容,如果未能解决你的问题,请参考以下文章

jquery 新手想问一下trigger('click')问题

cf1072B. Curiosity Has No Limits(枚举)

电脑蓝屏怎么办 a problem has been detected and windows

5Windows has encountered a problem communicating with a device connected to your computer

python提示AttributeError: 'NoneType' object has no attribute 'append'

python提示AttributeError: 'NoneType' object has no attribute 'append'转发