Skip to content

Add aligned memory allocators

Emmanuele Bassi requested to merge ebassi/aligned-alloc into main

When working with storage (especially GInputStream or GOutputStream) it is preferred to use page-aligned buffers so that the operating system can do page-mapping tricks as the operation passes through the kernel.

Another use case is allocating memory used for vectorised operations, which must be aligned to specific boundaries.

POSIX and Windows, as well as the C11 specification, provide this kind of allocator functions, and GLib already makes use of it inside GSlice. It would be convenient to have a public, portable wrapper that other projects can use.

Fixes: #2574 (closed)

Edited by Philip Withnall

Merge request reports