-void* aligned_ttmem_alloc(size_t allocSize, void*& mem) {
-
- constexpr size_t alignment = 2 * 1024 * 1024; // assumed 2MB page sizes
- size_t size = ((allocSize + alignment - 1) / alignment) * alignment; // multiple of alignment
- if (posix_memalign(&mem, alignment, size))
- mem = nullptr;
-#if defined(MADV_HUGEPAGE)
- madvise(mem, allocSize, MADV_HUGEPAGE);
-#endif
- return mem;
-}
-
-#elif defined(_WIN64)
-
-static void* aligned_ttmem_alloc_large_pages(size_t allocSize) {