The Unified Memory Framework (UMF) is a library for constructing allocators and memory pools. It also contains broadly useful abstractions and utilities for memory management. UMF allows users to manage multiple memory pools characterized by different attributes, allowing certain allocation types to be isolated from others and allocated using different hardware resources as required.
A UMF memory pool is a combination of a pool allocator and a memory provider. A memory provider is responsible for coarse-grained memory allocations and management of memory pages, while the pool allocator controls memory pooling and handles fine-grained memory allocations.
Pool allocator can leverage existing allocators (e.g. jemalloc or tbbmalloc) or be written from scratch.
UMF comes with predefined pool allocators (see include/pool) and providers (see include/provider). UMF can also work with user-defined pools and providers that implement a specific interface (see include/umf/memory_pool_ops.h and include/umf/memory_provider_ops.h)
Required packages:
- C++ compiler with C++17 support
- CMake >= 3.14.0
For development and contributions:
- clang-format-15.0 (can be installed with
python -m pip install clang-format==15.0.7
)
Generating Visual Studio Project. EXE and binaries will be in build/bin/{build_config}
$ mkdir build
$ cd build
$ cmake {path_to_source_dir} -G "Visual Studio 15 2017 Win64"
Executable and binaries will be in build/bin
$ mkdir build
$ cd build
$ cmake {path_to_source_dir}
$ make
All code has to be formatted using clang-format. To check the formatting do:
$ mkdir build
$ cd build
$ cmake {path_to_source_dir} -DUMF_FORMAT_CODE_STYLE=ON
$ make clang-format-check
Additionally, to apply code formatting do:
$ make clang-format-apply
List of options provided by CMake:
Name | Description | Values | Default |
---|---|---|---|
UMF_BUILD_SHARED_LIBRARY | Build UMF as shared library | ON/OFF | OFF |
UMF_BUILD_TESTS | Build UMF tests | ON/OFF | ON |
UMF_ENABLE_POOL_TRACKING | Build UMF with pool tracking | ON/OFF | ON |
UMF_DEVELOPER_MODE | Treat warnings as errors and enables additional checks | ON/OFF | OFF |
UMF_FORMAT_CODE_STYLE | Add clang-format-check and clang-format-apply targets to make | ON/OFF | OFF |