X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fmisc.cpp;h=946810088da8a3ee74989215c852029e8879c1cb;hp=4d6483e73d20f78d352429bbc24289a648fc3649;hb=8a1de2655ce9790d5f0360e2baefb0f5c0fe2944;hpb=fcaf0736feb17f1eb639a7ae071acc920b308f74 diff --git a/src/misc.cpp b/src/misc.cpp index 4d6483e7..94681008 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -303,7 +303,8 @@ 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 - mem = aligned_alloc(alignment, size); + if (posix_memalign(&mem, alignment, size)) + mem = nullptr; madvise(mem, allocSize, MADV_HUGEPAGE); return mem; }