Purgeable Memory Allocations for Linux
Purgeable memory is a contiguous allocation that can be reclaimed by the
kernel at any time while unlocked. Before accessing or using the
allocation, it must be locked, and then unlocked when no longer in
active use. See
purgeable.h for API documentation.
Full article: Purgeable Memory Allocations for Linux
void *purgeable_alloc(size_t); void purgeable_unlock(void *); void *purgeable_lock(void *); void purgeable_free(void *);
To test it out, disable swap (
swapoff), run one or more instances of
test, then run
hog consumes more and more memory (before
being killed by the OOM killer), instances of
test will see their
regions get reclaimed and exit.