English 中文(简体)
如何纠正错误?
原标题:How to fix the heap error?

I m在C++运行一个迭代程序,在完成第一个迭代之后,我从第二个错误开始出现以下错误:

Heap block at 00000000212005D0 modified at 0000000021200674 past requested size of 94 Windows has triggered a breakpoint in myProject.exe.

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

This may also be due to the user pressing F12 while myProject.exe has focus.

产出窗口可能有更多的诊断信息。

在显示这一错误的同时,视力-C++打开了破碎机。

extern "C" _CRTIMP int __cdecl _CrtIsValidHeapPointer(
        const void * pUserData
        )
{
        if (!pUserData)
            return FALSE;

        if (!_CrtIsValidPointer(pHdr(pUserData), sizeof(_CrtMemBlockHeader), FALSE))
            return FALSE;

        return HeapValidate( _crtheap, 0, pHdr(pUserData) );
}

这一错误的原因是什么?

最佳回答

这一节是检查问题的有效性的方法,而不是问题的根源。

您最有可能处理memory corruption,这种腐败可能难以减少。 您的最佳工具是操作一种记忆分析器工具(例如 Pur),或者,如果密码库很小,则通过它去除,直到你找到来源。

当然,任何不明确的行为都可能导致这种情况。 最常见的来源是:

  • forgetting to return from a function that defines a return type
  • deleting objects multiple times
  • deleting derived objects through pointers to a base class with no virtual destructor
  • invalid use of casts (C-style casts, const_cast, reinterpret_cast)
  • accessing memory you don t own (writing beyond the bounds of allocated memory)
  • etc. (feel free to add here)

I d start with a full rebuild though... you never know!

问题回答

我要补充的是,如果你愿意获得净化,那么val也是一种很好的工具,而且很可能可以弥补这一错误。

同样,由于你感到悲伤,你必须再次建设你的项目(如纯洁)。 你们只能经受val笑,val也很快。





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签