diff --git a/src/mem/largealloc.h b/src/mem/largealloc.h index 90b88da9d..8d714baff 100644 --- a/src/mem/largealloc.h +++ b/src/mem/largealloc.h @@ -368,7 +368,18 @@ namespace snmalloc } }; - using GlobalVirtual = MemoryProviderStateMixin; +#ifndef SNMALLOC_DEFAULT_MEMORY_PROVIDER +# define SNMALLOC_DEFAULT_MEMORY_PROVIDER MemoryProviderStateMixin +#endif + + /** + * The type of the default memory allocator. This can be changed by defining + * `SNMALLOC_DEFAULT_MEMORY_PROVIDER` before including this file. By default + * it is `MemoryProviderStateMixin` a class that allocates directly from + * the platform abstraction layer. + */ + using GlobalVirtual = SNMALLOC_DEFAULT_MEMORY_PROVIDER; + /** * The memory provider that will be used if no other provider is explicitly * passed as an argument. diff --git a/src/mem/pool.h b/src/mem/pool.h index 69de2ca7a..713cbfa37 100644 --- a/src/mem/pool.h +++ b/src/mem/pool.h @@ -24,6 +24,7 @@ namespace snmalloc friend Pooled; template friend class MemoryProviderStateMixin; + friend SNMALLOC_DEFAULT_MEMORY_PROVIDER; std::atomic_flag lock = ATOMIC_FLAG_INIT; MPMCStack stack;