Enable Huge Pages and Transparent Huge Pages (THP)
developrpmalloc supports huge/large pages on Windows, Linux, and macOS. These modes are mutually exclusive, and enable_huge_pages takes precedence.
Explicit Huge Pages
To enable explicit huge pages, pass a non-zero value for enable_huge_pages in the configuration object when calling rpmalloc_initialize_config.
- Requirement: Requires system configuration (e.g., a preallocated huge page pool on Linux or
SeLockMemoryPrivilegeon Windows). - Fallback: If requested but unavailable,
rpmalloc_initialize_configreturns a non-zero value and leaves the allocator uninitialized. You can then re-initialize without huge pages.
Transparent Huge Pages (THP)
On Linux and Android, you can use transparent huge pages without special system configuration.
- How to enable: Pass a non-zero value for
enable_thpin the configuration object duringrpmalloc_initialize_config. This usesmadvise(MADV_HUGEPAGE)to advise the kernel.