Skip to content

skeeto/purgeable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 *);

This idea was inspired by OS hacking: Purgeable memory (discussion).

To test it out, disable swap (swapoff), run one or more instances of test, then run hog. As hog consumes more and more memory (before being killed by the OOM killer), instances of test will see their regions get reclaimed and exit.

About

Purgeable memory allocations for Linux

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published