What does this error message mean? Thank you for your help

Heap corruption detected at 0072FB10
HEAP[algo.exe]: HEAP: Free Heap block 72fb08 modified at 72fb1c after it was freed
Windows has triggered a breakpoint in algo.exe.

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

The output window may have more diagnostic information

Recommended Answers

All 4 Replies

It means you probably wrote to memory you don't own, perhaps by overrunning a buffer, freeing memory more than once, or forgetting to initialize a pointer before using it.

But how do I detect this bug? I am using Microsoft Visual studio 2005, I try putting data breakpoint at address 72fb08 and 72fb1c, but it doesn't helps.

Well if the address is consistent from one run to another, then you could set a hardware breakpoint to trap whenever that location is written to.

That would then point you directly at the line of code which is messing with the memory it shouldn't be.

ok, thank you for your help guys.

I found my problem, I declared an array of pointers but I didn't initialize them to NULL. Then when I allocate memory to other arrays, somehow the uninitialized array of pointers is actually pointing to my new allocated arrays, resulting in the memory error.

Lesson learnt, always initialized array to NULL even if you are planning allocate memory to it later.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.