<p>In Linux environment, when getting "glibc detected *** free(): invalid pointer" errors, how do I identify which line of code is causing it?</p>

<p>Is there a way to force an abort? I recall there being an ENV var to control this?</p>

<p>How to set a breakpoint in gdb for the glibc error?</p>

In general, it looks like you might have to recompile glibc, ugh.
You don't say what environment you're running on, but if you can recompile your code for OS X, then its version of libc has a free() that listens to this environment variable:
```
```
MallocErrorAbort             If set, causes abort(3) to be called if an
                              error was encountered in malloc(3) or
                              free(3) , such as a calling free(3) on a
                              pointer previously freed.
```
```
The man page for free() on OS X has more information.
If you're on Linux, then try
Valgrind
, it can find some impossible-to-hunt bugs.