Ms Visual Studio上的C ++错误:“ Windows在javaw.exe中触发了断点” [英] C++ error on Ms Visual Studio: "Windows has triggered a breakpoint in javaw.exe"

查看:102
本文介绍了Ms Visual Studio上的C ++错误:“ Windows在javaw.exe中触发了断点”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在开发软件C ++& Java(使用Microsoft Visual Studio 2008和Eclipse构建),我一直在尝试将其从32位系统迁移到64位系统。

I've been always working on my software C++ & Java (build with Microsoft Visual Studio 2008 & Eclipse), and I've been trying to move it from a 32-bit system to a 64-bit one.

编译阶段还可以,但是在执行时,我收到一条错误消息:

The compilation phase is alright, but on execution I get an error that says:


Windows触发了javaw.exe中的断点。
可能是由于
堆损坏,这表明javaw.exe或
中已加载的DLL中的任何一个错误-
这也可能是由于用户在javaw时按下F12 .exe具有焦点。
输出窗口可能包含更多诊断信息。
[BREAK] [继续] [IGNORE]

"Windows has triggered a breakpoint in javaw.exe. This may be due to corruption of the heap, which indicates a bug in javaw.exe or any of the DLLs it has loaded-. This may also be due to user pressing F12 while javaw.exe has focus. The output window may have more diagnostic information. [BREAK] [CONTINUE] [IGNORE]"

您可以在此处查看错误的快照:

You can see a snapshot of the error here:

您是否知道此错误的含义?
堆的腐败是什么意思?
您以前有没有遇到过此类错误的经验?

Have you any idea of what this error means? What does "corruption of the heap" mean? Have you evere had any experience with this kind of error before?

非常感谢!

推荐答案

这是Windows堆分配器的一个非常不错的功能,自Vista开始提供。它告诉您您的代码有一个指针错误。好吧,希望它是您的代码,而不是具有错误的JVM :)您最好假定它是您的代码。

It is a very nice feature of the Windows heap allocator, available since Vista. It tells you that your code has a pointer bug. Well, hopefully it is your code and not the JVM that has the bug :) You'd better assume it is your code.

实际原因介于温和,就像试图释放已经从另一个堆释放或分配的内存(当您与另一个程序互操作时并不少见)一样,变得非常讨厌,例如通过溢出堆分配的缓冲区使堆更早破碎。

The actual cause ranges somewhere between mild, like trying to free memory that was already freed or allocated from another heap (not uncommon when you interop with another program), to drastically nasty, like having blown the heap to pieces earlier by overflowing a heap allocated buffer.

诊断的粒度不足以告诉您到底出了什么问题,只是出了点问题。通常,您需要仔细检查代码并人为地禁用大量代码,直到错误消失,然后再逐一查找。这就是显式内存管理的乐趣。如果32位版本是干净的(检查它),则由于有关指针大小的假设,因此可以将其与64位代码关联。 64位指针不适合int或long类型,因此将被截断。使用截断后的指针值将触发此断言。这是很高兴的问题,您可以在调用堆栈窗口中找到故障代码。

The diagnostic is not fine-grained enough to tell you exactly what went wrong, just that there's something wrong. You typically chase it down with a careful code review and artificially disabling chunks of code until the error disappears. Such are the joys of explicit memory management. If the 32-bit version is clean (check it) then this can be associated with 64-bit code due to assumptions about pointer size. A 64-bit pointer doesn't fit in an int or long, so it is going to get truncated. And using the truncated pointer value is going to trigger this assert. That's the happy kind of problem, you'll find the trouble code back in the Call Stack window.

这篇关于Ms Visual Studio上的C ++错误:“ Windows在javaw.exe中触发了断点”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆