I get this error: “glibc detected”

Even if you’re not allocating memory directly, it happens under the hood in vector code and you most likely corrupted some portion of memory by writing where you are not supposed to. The most likely reasons I can think of are:

  1. Writing to an element that is out of bounds
  2. Using a pointer/reference to an element that is no longer valid — note that inserting more elements can invalidate earlier references

Of course, I can’t say for sure unless you post some relevant code. Or try using valgrind to find the source of the problem.

Leave a Comment