I have this for loop:
for(int l = 0; l < level_max; ++l) {
//...
indexCount[l] = (2*patch_size_level+1) * (patch_size_level - 1);
GLuint* indices = new GLuint[indexCount[l]];
//... (for loops in which I fill indices)
delete[] indices;
}
(full code snippet can be found here: https://gist.github.com/1915777)
For some reason this throws the following memory exception at GLuint* indices = new GLuint[indexCount[l]];
Demo(12783,0x7fff7367e960) malloc: * error for object 0x1028cd408:
incorrect checksum for freed object – object was probably modified
after being freed.
What am I doing wrong? I’m not assigning more than indexCount[l] values to my indices array. (I’ve checked this). How do you properly delete a dynamic array in a loop like this.
Thanks
Issues has been resolved.. It was a prior
new[]call (in another method) which didnt have the proper size, which caused the problem here. Thanks a lot for your help guys!