I posted a yesterday about creating and deleting arrays but my example program worked fine when corrected while the problem I have with my larger program remains.
Essentially I am trying to delete a float array I created in memory but I get the "HEAP CORRUPTION DETECTED: after Normal block" error when I do so.
I know that the array is valid because as a test in the destructor for the class I do a stupid loop through the values in the to-be-deleted array with no problem like so:
/*
This code 100% works in the destructor for the class.
Note: I know the array has 24 elements as in this case it is a fixed size I create in the constructor.
*/
for (int i = 0; i < 23; ++i) {
GLfloat CurrentValue = ArrayValues[i];
CurrentValue = CurrentValue;
}
/*
I get the "HEAP CORRUPTION" error when trying to delete this valid array.
*/
delete [] ArrayValues;
Anyone knows the reason I would get the error for a valid array?
First, realize that your for loop is essentially doing nothing useful, as far as I can tell. You create local variable and then do nothing with that local variable (assign it to itself).
Where do you define and initialize your ArrayValues pointer? I think more relevant code needs to be shown.
Correct, the loop was something stupid to verify that array was indeed valid and I used the debugger to see if "CurrentValue" had the value of the ArrayValue element indicated by "i" in the loop,
At first glance at the code given, I see nothing wrong. It must be a combination of something else, sorry wish I could help more. Not sure if opengl's float is doing something weird behind the scenes.