Expand description
A size-classed file-backed large object allocator.
This library contains types to allocate memory outside the heap, supporting power-of-two object sizes. Each size class has its own memory pool.
§Safety
This library is very unsafe on account of unsafe
and interacting directly
with libc, including Linux extension.
The library relies on memory-mapped files. Users of this file must not fork the process because otherwise two processes would share the same mappings, causing undefined behavior because the mutable pointers would not be unique anymore. Unfortunately, there is no way to tell the memory subsystem that the shared mappings must not be inherited.
Clients must not lock pages (mlock
), or need to unlock the pages before returning them
to lgalloc.
Structs§
- Configuration for lgalloc’s background worker.
- Statistics per size class and backing file.
- Handle to describe allocations.
- Lgalloc configuration
- Statistics about lgalloc’s internal behavior.
- Statistics per size class.
Enums§
- Allocation errors
Constants§
- Range of valid size classes.
Functions§
- Allocate a memory area suitable to hold
capacity
consecutive elements ofT
. - Free the memory referenced by
handle
, which has been obtained fromallocate
. - Set or update the configuration for lgalloc.
- Determine global statistics per size class