2

Just dropped-in the tcmalloc 2.7, but for some reason my new which calls aligned_alloc still goes to glibc. I've added following to the compiler options -fno-builtin-memalign -fno-builtin-aligned_alloc -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -nostdlib with no visible effect.

Ubuntu 18.04, stock GCC, tcmalloc 2.7

Am I doing something wrong?

EDIT001: for some reason GCC flag -flto=8 was causing this behavior, first I was suspecting the --gc-sections messing with symbols, but it was proven to be wrong, somehow the -flto did the difference.
If anyone knows why, you are most welcome to explain it here

kreuzerkrieg
  • 3,009
  • 3
  • 28
  • 59
  • Can you post a backtrace from the point where `aligned_alloc` is called? I suspect it's from `libstdc++`. – Florian Weimer Jan 06 '19 at 13:12
  • It is, I was stepping into in debugger to see what implementation is called. In any case as I found later, it is `-flto` to blame. jemalloc does not kick in too if this flag is applied (see here https://stackoverflow.com/questions/53904726/gcc-flto-fno-builtin-and-custom-function-implementation-of-glibc-functions) Opened issues for both `tcmalloc` and `jemalloc` in their respective repositories on GitHub – kreuzerkrieg Jan 06 '19 at 15:10

0 Answers0