3

I installed tcmalloc on CentOS using the command:

sudo yum install google-perftools

And it proceeds correctly. But I cannot find any installed perftools libraries in /usr/lib/, so I cannot set LD_PRELOAD variable.

Then, when I tried to compile with flag -ltcmalloc, the compiler did not recognize it, which quite made sense.

What else should I specify to use tcmalloc on CentOS? Thanks.

jww
  • 97,681
  • 90
  • 411
  • 885
hiimdaosui
  • 361
  • 2
  • 12
  • Do you have a `tcmalloc (3)` man page? CentOS is pretty good about supplying docs and they are usually pretty good. – jww Aug 30 '18 at 20:51
  • @jww no, there isn't one. `No manual entry for tcmalloc`. – hiimdaosui Aug 30 '18 at 20:58
  • According to [gperftools](https://github.com/gperftools/gperftools) you link `-ltcmalloc` or `-ltcmalloc_minimal`. But I can't find it searching in `/lib` or `/lib64` (`find /lib64 -name '*tcmalloc*'`). – jww Aug 30 '18 at 21:02
  • @jww I tried that, but I got `/usr/bin/ld: cannot find -ltcmalloc` – hiimdaosui Aug 30 '18 at 21:04
  • [`dnf repoquery -l gperftools`](https://stackoverflow.com/a/107520/608639) shows the package is empty. It sucks to be you right about now :) – jww Aug 30 '18 at 21:08
  • @jww Thanks man. I guess I have to build from source then. – hiimdaosui Aug 30 '18 at 21:09
  • 1
    Lets see if anything interesting drops out from [Fedora package contains no files?](https://unix.stackexchange.com/q/465857/56041) – jww Aug 30 '18 at 21:15
  • @jww I really appreciate that! Hope we could figure this out. – hiimdaosui Aug 30 '18 at 21:37

2 Answers2

2

The package names have changed a little. Just run:

yum install gperftools gperftools-devel

...and you'll find various libtcmalloc files in /usr/lib64/

Eljuan
  • 84
  • 8
0

You can always build from source. I have done that with my centos 8.

Source code can be found here: https://github.com/google/tcmalloc. Be aware you will need bazel for building the project.

yushizhao
  • 67
  • 1
  • 7