What does this mean?

Hello

i was playing with some pointer arrays and i made a function to expand the pointer array when it was full.

when i exited the app i got this error msg saying

Debug error

HEAP CORRUPTION DETECTED after normal block (#247) at 0x00385590
CRT detected that the application wrote to memory after the heap buffer.

can someone tell me what this means?
and what can be causing this?

thanks :)
Last edited on
Heap corruption means you're stepping out of bounds of your dynamically allocated array and writing to an address you shouldn't be.

Sometimes the program will crash on the delete line (if you're lucky), other times it won't and the error will go quietly unnoticed.

Example of heap corruption:

1
2
3
4
5
6
int* buf = new int[10];  // make 10 ints

buf[12] = 15;  // compiles okay, but bad!  'buf' is not big enough... there is no 12th index

delete[] buf;  // might crash here, might not.
// either way, this is *very bad* 
Ok my app crashes at the delete[] how can i prevent this?
Don't go out of bounds in your array.

Can't get more specific than that without seeing code.
check you bounder of array.

never forgot to free the memory and don't break the bounder
Topic archived. No new replies allowed.