I use tcmalloc in my main program A by adding -ltcmalloc in linking time. When A starts, it will dynamically load several precompiled .so files, such as B.so, C.so. then, will the malloc() in B.so and C.so use tcmalloc automatically?
When A starts, it will dynamically load several precompiled .so files, such as B.so, C.so. then, will the malloc() in B.so and C.so use tcmalloc automatically?
Depends on your OS, and possibly on whether you are using archive or shared version of libtcmalloc.
On Linux (and other ELF platforms), using libtcmalloc.so, the answer is yes.
On Linux, using libtcmalloc.a, the answer is "most likely". To make it a "definite yes", add -rdynamic to the link line for the main executable.
On AIX, the answer is no, unless you add a bunch of non-trivial options to B.so and C.so link lines.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With