Windows has triggered a breakpoint in ZLib.exe.
This may be due to a corruption of the heap, which indicates a bug in ZLib.exe or any of the DLLs it has loaded.
This may also be due to the user pressing F12 while ZLib.exe has focus.
The output window may have more diagnostic information.
[/quote]
I don't see anything extra in the output window, other than "[font=Consolas][size=1][font=Consolas][size=1][size=2]Critical error detected c0000374"[/font][/font]
Using breakpoints, I've narrowed down the line that causes the error to this.
int* temp = new int[new_len];
I've also checked the value of new_len in debug mode, to make sure that wasn't the problem, and it is an int variable equal to 11 when it hits this spot. I didn't post all the code, as I can't see why this would fail regardless, but I can if needed. Can anyone help me figure out what's going on?
Why would this fail?
I am working on developing code to write text to the screen using C++ and DirectX11, and in the code where the text can be changed, I'm getting an error. The error says
You probably have heap corruption. Some previous pointer access or buffer overrun has trashed bookkeeping memory used by the heap. This can be due to writing to deleted memory, writing past the end of a buffer or similar problems.
Thanks for quick response!
Is there any easier way to track that down than to follow every step of the program, manually tracking those items?
Is there any easier way to track that down than to follow every step of the program, manually tracking those items?
In tightening up your memory management it might be helpful to add this line at the start of main(), if you haven't already...it will alert you of leaks and potentially where they are, which might also lead to discovering where the heap is getting corrupted.
[font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]#if[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"] [/font][/font][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]defined[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"](DEBUG) | [/font][/font][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]defined[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"](_DEBUG)[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"] _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );[/font][/font]
[font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]#endif[/font][/font][/font]
[font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]#if[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"] [/font][/font][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]defined[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"](DEBUG) | [/font][/font][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]defined[/font][/font][/font][font="Consolas"][size="2"][font="Consolas"][size="2"](_DEBUG)[/font][/font]
[font="Consolas"][size="2"][font="Consolas"][size="2"] _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );[/font][/font]
[font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"][font="Consolas"][size="2"][color="#0000ff"]#endif[/font][/font][/font]
Depending on your compiler, it may have heap debugging facilities. For example, the code sanchopan posted is MSVC specific. On Windows you can also use Application Verifier to debug some kinds of heap usage errors such as buffer overruns.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement