Thread: GLIBC DETECTED error

  1. #1
    Registered User
    Join Date
    Jul 2010


    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????

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    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.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Winsock problem
    By Wolf` in forum Windows Programming
    Replies: 1
    Last Post: 05-01-2010, 04:55 PM
  2. Testing some code, lots of errors...
    By Sparrowhawk in forum C Programming
    Replies: 48
    Last Post: 12-15-2008, 04:09 AM
  3. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  4. Making C DLL using MSVC++ 2005
    By chico1st in forum C Programming
    Replies: 26
    Last Post: 05-28-2008, 01:17 PM
  5. Couple C questions :)
    By Divx in forum C Programming
    Replies: 5
    Last Post: 01-28-2003, 01:10 AM