-
GLIBC DETECTED error
I hope someone can help me out. I have a 2D vector, and I am trying to erase an entry in the vector and I am getting the following error.
*** glibc detected *** ./a.out: free(): invalid next size (fast): 0x082bf938 ***
Right before I get the error the size of the 2D array is 11 and the entry I am deleting is number 10.
I have
2dvector.erase(2dvector.begin()+ *rit);
which is where the error is coming from, and right before the error,
2dvector.size() = 11
*rit = 10.
Anyone have any suggestions on how I can go about debugging this????
-
First, create a very small test program that contains ONLY the 2D vector of size 11 and then you try to erase the element you're interested in.
If that doesn't crash, then the problem is ELSEWHERE in your code.
That is, some other code trashed the memory, and this code paid the price.
You could use valgrind, and set it to run the debugger whenever it notices a problem.