summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/support/alloc.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/support/alloc.h b/src/support/alloc.h
index 86c49d2f5..075896694 100644
--- a/src/support/alloc.h
+++ b/src/support/alloc.h
@@ -37,6 +37,10 @@ inline void* aligned_malloc(size_t align, size_t size) {
void* ret = _aligned_malloc(size, align);
if (errno == ENOMEM) ret = nullptr;
return ret;
+#elif defined(__APPLE__)
+ void *ptr;
+ int result = posix_memalign(&ptr, align, size);
+ return result == 0 ? ptr : nullptr;
#else
return aligned_alloc(align, size);
#endif