google / tcmalloc

Apache License 2.0
4.41k stars 480 forks source link

what is the relationship between tcmalloc and abseil library #250

Closed lano1106 closed 3 months ago

lano1106 commented 3 months ago

Hi,

I have just built your project with the intention of replacing my gperftools/tcmalloc by this new tcmalloc and I have noticed that bazel was fetching abseil and compiling it.

this made me wonder...

is it some sort of circular dependency? ie: tcmalloc depends on abseil and abseil will use tcmalloc if present...

or maybe abseil is only used in the tcmalloc testing suite...

or maybe abseil is specially rebuilt to use tcmalloc...

this part is really not clear in my mind and it is important to clear out so I can make my packaging appropriately. ie: My system is ArchLinux and I use their official Abseil lib package. Will I need to replace it if I deploy your tcmalloc?

Also, you mention -DABSL_ALLOCATOR_NOTHROW define in your doc. It is not clear in your doc and in https://abseil.io/docs/cpp/guides/base if defining this define is recommended and when it should be defined.

Is it when building tcmalloc and Abseil or only when client code is compiled?

and one last question.

Beside if someone wants to use tcmalloc extensions, there is no special header files to include... tcmalloc will be integrated in the binary at link time only, right?

ckennelly commented 3 months ago

Abseil does not depend on TCMalloc, so there's no circular dependency.

TCMalloc extensions require including tcmalloc/malloc_extensions.h. We have stub implementations so things build-and-link when not linked against TCMalloc, but the general expectation is that TCMalloc provides meaningful functionality.

lano1106 commented 3 months ago

wow thx, for the very fast reply... you must be receiving notifications!

does TCMalloc depends on Abseil then?

P.S.: I have become a big fan of Matt Kulukundis after having watched his talk: https://www.youtube.com/watch?v=ncHmEUmJZf4

ckennelly commented 3 months ago

Yes, TCMalloc depends on Abseil.

lano1106 commented 3 months ago

thanks a lot for your replies...

it is very helpful

I intend to read your source code to be in position to answers all these questions by myself but right now, I am in the dark about everything...