Currently valgrind fails on such programs: ==26700== Invalid write of size 8 ==26700== at 0x4E45D1D: tcmalloc::Static::InitStaticVars() (in /usr/local/lib/libtcmalloc.so.4.3.0) ==26700== by 0x4E46CA6: tcmalloc::ThreadCache::InitModule() (in /usr/local/lib/libtcmalloc.so.4.3.0) ==26700== by 0x4E576E4: calloc (in /usr/local/lib/libtcmalloc.so.4.3.0) ==26700== by 0x9C1E139: _thr_alloc (in /lib/libthr.so.3) ==26700== by 0x9C1F292: _libpthread_init (in /lib/libthr.so.3) ==26700== by 0x9C221D1: ??? (in /lib/libthr.so.3) ==26700== by 0x9C14EA5: ??? (in /lib/libthr.so.3) ==26700== by 0x400432D: _rtld (in /libexec/ld-elf.so.1) ==26700== by 0x40024E8: ??? (in /libexec/ld-elf.so.1) ==26700== Address 0x742b80 is not stack'd, malloc'd or (recently) free'd ==26700== ==26700== ==26700== Process terminating with default action of signal 11 (SIGSEGV): dumping core Reproducible: Always valgrind-3.10.1
This should already work when using --soname-synonyms=somalloc=xxx (see the manual). In valgrind 3.12 this should even work out of the box without the user having to specify the malloc library by intercepting any interposed malloc related functions. See bug #355188. *** This bug has been marked as a duplicate of bug 355188 ***