Expand description
A Rust raw wrapper over Google’s TCMalloc memory allocator
§Feature flags
extension
(enabled by default) — TCMalloc extension APInuma_aware
— Enable NUMA-aware allocation. Need to useTCMALLOC_NUMA_AWARE
environment variable at runtime. See TCMalloc commentsdeprecated_perthread
— Use deprecated per-thread caching. Newer systems with Linux kernel version >= 4.18 should not use this.legacy_locking
— Use legacy locking. See TCMalloc docs
§Logical Page Sizes (These features are mutually exclusive).
Larger page size leads to greater performance in expense to increased fragmentation. See TCMalloc tuning guide
8k_pages
(enabled by default) — 8k pages32k_pages
— Large pages256k_pages
— 256k pagessmall_but_slow
— 4k pages, option for memory-constrained systems
§Madvise Transparent Hugepages control (Use no more than one value)
By default, if none of these features are enabled, madvise hugepages will be enabled.
disable_madv_hugepage_always
— Disable madvise hugepagesdisable_madv_hugepage_by_var
— Disable madvise hugepages via environment variableTCMALLOC_DISABLE_MADV_HUGEPAGE
at runtime. This variable can be set to0
or1
to enable or disable madvise hugepages respectively.
Functions§
- Bridge
Prepare ⚠Realloc Aligned - Prepare to reallocate previously allocated memory.
- BridgeTC
Malloc ⚠Internal NewAligned Nothrow - Allocate
size
bytes aligned byalignment
. - Needs
Process ⚠Background Actions extension
- Return true if
ProcessBackgroundActions
should be called on this platform. - Process
Background ⚠Actions extension
- Runs housekeeping actions for the allocator off of the main allocation path.
- TCMalloc
Internal ⚠Delete Aligned - Free previously allocated memory.
- TCMalloc
Internal ⚠Delete Sized Aligned - Free previously allocated memory.