Paul Eggert wrote: > > aligned_alloc won't help here: On the platforms without posix_memalign > > (namely, native Windows, see above), we don't have an aligned_alloc > > implementation. > > If MS-Windows is the only platform without posix_memalign
... the only modern platform. Older versions of *BSD etc. also lack posix_memalign. > perhaps we > should use _aligned_malloc and _aligned_free functions on that platform. > Then we can stop using mmap and malloc entirely, and there will be no > need for a linked list or for a more-complicated data structure. This won't fix the waste problem because the Microsoft documentation [1] says "_aligned_malloc is based on malloc." which means that for a request of 1 page it allocates 2 pages and thus wastes 1 page. Which is not better than our malloc-based implementation. But it would fix the need for a linked list, as you say. So, this alternative is worth trying. Bruno [1] https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/aligned-malloc
