I ran into this error in some code where someone was calling exit() in one thread about the same time as main()
returned, so all the global/static constructors were being kicked off in two separate threads simultaneously.
This error also manifests as double free or corruption
, or a segfault/sig11 inside exit()
or inside malloc_consolidate
, and likely others. The call stack for the malloc_consolidate crash may resemble:
#0 0xabcdabcd in malloc_consolidate () from /lib/libc.so.6
#1 0xabcdabcd in _int_free () from /lib/libc.so.6
#2 0xabcdabcd in operator delete (...)
#3 0xabcdabcd in operator delete[] (...)
(...)
I couldn't get it to exhibit this problem while running under valgrind.