Wiki

Clone wiki

memoria / Memory Allocation

Block Allocator

Top-level object in Memoria is a container that transforms logical representation of data structure interfaces to physical memory. The largest memory object that the container operates is memory block of variable but limited size. Default block size for all containers is 4KB. These memory blocks (pages in terms of Memoria) are managed with a block allocator. Block life-cycle is managed via RAII-based wrappers.

Memoria defines abstract interface that block allocators must implement. The rest of physical memory block management is responsibility of the allocator. It can be implemented in any language or storage technology, including in-memory, disk with memory caching, shared memory, distributed shared shared memory etc. See Block Allocator documentation for technical details.

Packed Allocator

Small, dynamically sized data objects are placed within memory blocks in a contiguous memory space. In this case, if an object is resized, position of some other objects have to be changed. To organize position-independent access to the data objects inside a block, Memoria maintains a small but very flexible hierarchical dictionary of contiguous sub-blocks using technique similar to dynamic vectors. See PackedAllocator documentation for technical details.

Software Transactional Memory

No direct memory addressing is used by Memoria's containers, except several short-time optimizations. So at least block-level persistence can be easily implemented at the level of Block Allocator.

Updated