File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -368,7 +368,18 @@ namespace snmalloc
368368 }
369369 };
370370
371- using GlobalVirtual = MemoryProviderStateMixin<Pal>;
371+ #ifndef SNMALLOC_DEFAULT_MEMORY_PROVIDER
372+ # define SNMALLOC_DEFAULT_MEMORY_PROVIDER MemoryProviderStateMixin<Pal>
373+ #endif
374+
375+ /* *
376+ * The type of the default memory allocator. This can be changed by defining
377+ * `SNMALLOC_DEFAULT_MEMORY_PROVIDER` before including this file. By default
378+ * it is `MemoryProviderStateMixin<Pal>` a class that allocates directly from
379+ * the platform abstraction layer.
380+ */
381+ using GlobalVirtual = SNMALLOC_DEFAULT_MEMORY_PROVIDER;
382+
372383 /* *
373384 * The memory provider that will be used if no other provider is explicitly
374385 * passed as an argument.
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ namespace snmalloc
2424 friend Pooled<T>;
2525 template <SNMALLOC_CONCEPT(ConceptPAL) PAL>
2626 friend class MemoryProviderStateMixin ;
27+ friend SNMALLOC_DEFAULT_MEMORY_PROVIDER;
2728
2829 std::atomic_flag lock = ATOMIC_FLAG_INIT;
2930 MPMCStack<T, PreZeroed> stack;
You can’t perform that action at this time.
0 commit comments