google / tcmalloc

Apache License 2.0
4.31k stars 463 forks source link

How to access tcmalloc MallocExtensions? #224

Closed CreativePSofficial closed 6 months ago

CreativePSofficial commented 6 months ago

Hello,

I currently have a program compiled with -ltcmalloc_minimal in the linker flags, which is sufficient to route all allocations to tcmalloc.

However, I was wondering how I could easily access MallocExtensions to do some custom stuff without directly including the entire tcmalloc source code into my build.

Thanks.

ckennelly commented 6 months ago

-ltcmalloc_minimal is coming from https://github.com/gperftools/gperftools.

malloc_extension.h evolves over time, so it needs to be directly included.