Skip to content

This library provides an efficient alternative to allocate large memory chunks from mmap region, using file system caching to enable auto-swapping.

License

Notifications You must be signed in to change notification settings

LinZhihao-723/mmap_allocator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a mmap based memory allocator, allow users to allocate dynamic memory in mmap region 
instead of heap, initially inspired by BigMaac allocator.
Processes which do not have enough swap space (such as processes running in an access-limited 
container) will benefit from swapping through kernel managed file cache.

The allocator is compiled as a linux dynamic library. You can use:
% LD_PRELOAD=$PATH_TO_LIB executable arguments
to execute whatever you want and replace the std allocator by the mmap allocator.

To build the library:
% make all

The path to the compiled library:
$PROJECT_PATH/build/lib/libmmap_allocator.so

Configurable environment variables:
ENV_MMAP_HEAP_SIZE: max mmap heap size, must be page aligned.
ENV_MMAP_ALLOCATOR_MIN_BSIZE: min block size which will be allocated in mmap region.
ENV_NAMING_TEMPLATE: path to the temp mmap files (invisible from fs during the runtime).
ENV_PROFILE_FILE_PATH: path to the profile file. Given this parameter to turn on the profiling.
ENV_PROFILE_FREQUENCY: profiling frequency in seconds.

About

This library provides an efficient alternative to allocate large memory chunks from mmap region, using file system caching to enable auto-swapping.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published