google / tcmalloc

Apache License 2.0
4.41k stars 480 forks source link

How to access tcmalloc MallocExtensions? #224

Closed CreativePSofficial closed 9 months ago

CreativePSofficial commented 9 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 9 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.