Add aligned memory allocators

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
This commit is contained in:
Emmanuele Bassi
2022-01-06 18:03:16 +00:00
committed by Philip Withnall
parent ae0ec9b753
commit 475d574440
4 changed files with 178 additions and 2 deletions

View File

@@ -1393,6 +1393,11 @@ g_alloca0
g_newa
g_newa0
<SUBSECTION>
g_aligned_alloc
g_aligned_alloc0
g_aligned_free
<SUBSECTION>
g_memmove
g_memdup