class
regiondefines a region of memory that might be physically backed depending on the allocator.
memory regions allow for easy managing of virtual memory in a platform abstract way. it provides some helper utilities to allocate correctly sized segments for the given type and even allows constructor/destructors to be called (using the memory::
types
typedefs
constructors, destructors, conversion operators
member-functions
Function documentation
memory:: region:: region(region& parent,
memory:: segment& segment,
uint64_t pageSize,
uint64_t alignment,
allocator_ base* allocator = new default_ allocator()) private
Brief
specialized constructor used for internal usage
Details
we keep this one private as it relies on certain conditions on the size of the segment (being aligned to pages, and starting at a page).
memory:: region:: region(uint64_t size,
uint64_t alignment,
allocator_ base* allocator = new default_ allocator())
Brief
constructs a region of atleast the given size, using the alignment value.
Details
Parameters | |
---|---|
size in | the minimum size you wish to create a virtual region for. |
alignment in | the alignment value of the region. |
allocator in | the allocator that should be used internally. |
std::optional<segment> memory:: region:: allocate(size_t size)
Brief
tries to allocate a segment of atleast the given size.
Parameters | |
---|---|
size in | the minimum size of the segment (will be aligned to the alignment rules). |
Returns | a memory:: |
std::optional<memory:: region> memory:: region:: create_region(size_t size,
std::optional<size_t> alignment,
allocator_ base* allocator = new default_ allocator())
Brief
creates a sub-region of atleast that size.
Details
Creates a sub region of atleast the given size. The region could be bigger depending on certain factors such as alignment, etc.. Destruction/cleanup happens automatically through the destructor of the created region.