Add backup code in case we can't get the page size.

ms-hamlib-compile-error
Mooneer Salem 2025-06-15 07:22:11 -07:00
parent 4fbc6b52fa
commit 10d843c2af
1 changed files with 3 additions and 1 deletions

View File

@ -30,7 +30,9 @@ void codec2_initialize_realtime(size_t heapSize)
Heap_ = (void*)_aligned_malloc(heapSize, sysInfo.dwPageSize);
#else
Heap_ = (void*)aligned_alloc(sysconf(_SC_PAGESIZE), heapSize);
auto pageSize = sysconf(_SC_PAGESIZE);
if (pageSize < O1HEAP_ALIGNMENT) pageSize = O1HEAP_ALIGNMENT;
Heap_ = (void*)aligned_alloc(pageSize, heapSize);
#endif // defined(WIN32)
assert(Heap_ != NULL);