I am allocating an array, and then when i call delete[] it causes the program to crash, the program works fine when I do not call delete. Here is my code
MyObject *myArray= new MyObject[numPoints];
delete[] myArray;
I'm super confused so any help would be appreciated
Also, when I debug I get the error message "HEAP CORRUPTION DETECTED: after Normal block (#48) at 0x000032E90. CRT detected that the application wrote to memory after end of heap buffer."
SOLUTION!: I was initializing the array with not enough space. For some reason I could still add things to the array but it would crash when the destructor was called.