xo-alloc2: ++ docs

This commit is contained in:
Roland Conybeare 2025-12-22 20:46:40 -05:00
commit acf371b8c2
5 changed files with 71 additions and 24 deletions

View file

@ -12,21 +12,44 @@ Context
.. ditaa::
:--scale: 0.99
+--------------------------------+
| IAllocator_DArena |
+--------------------------------+
| IAllocator_Xfer |
+--------------------------------+
| IAllocator_ImplType |
+--------------+-----------------+
|cBLU | DArena |
| AAllocator +-----------------+
| | ArenaConfig |
+--------------+-----------------+
+-------------------------------+--------------------------------------+
| | IAllocator_DX1Collector |
| | IAllocIterator_DX1CollectorIterator |
| IAllocator_DArena | |
| IAllocIterator_DArenaIterator +--------------------------------------+
| | DX1Collector |
| | DX1CollectorIterator |
| | |
+-------------------------------+---------+----------------------------+
| DArena | |
| DArenaIterator | |
+-----------------------------------------+ CollectorConfig |
| ArenaConfig | |
+-----------------------------------------+----------------------------+
+----------------------------------+-----------------------------------+
| RAllocator | RAllocIterator |
+----------------------------------+-----------------------------------+
| IAllocator_DX1Collector | IAllocIterator_DX1Collector |
| IAllocator_DArena | IAllocIterator_DArena |
+----------------------------------+-----------------------------------+
| IAllocator_Xfer | IAllocIterator_Xfer |
| IAllocator_Any | IAllocIterator_Any |
+----------------------------------+-----------------------------------+
| AAllocator | AAllocIterator |
+----------------------------------+-----------------------------------+
+---------------+------------------+----------------------+------------+
| | | AllocInfo | |
| generation | +----------------------+ |
| object_age | AllocError | AllocHeaderConfig | cmpresult |
| role | +----------------------+ |
| | | AllocHeader | |
+---------------+------------------+----------------------+------------+
.. code-block:: cpp
#incldue <xo/alloc2/AAllocator.hpp>
#include <xo/alloc2/AAllocator.hpp>
Class
-----

View file

@ -28,21 +28,44 @@ Context
#include <xo/alloc2/DArena.hpp>
Arena memory layout::
Arena memory layout
.. code-block:: text
<----------------------------size-------------------------->
<------------committed-----------><-------uncommitted------>
<--allocated-->
<----------------------------size-------------------------->
<------------committed-----------><-------uncommitted------>
<--allocated-->
XXXXXXXXXXXXXXX___________________..........................
^ ^ ^ ^
lo free limit hi
XXXXXXXXXXXXXXX___________________..........................
^ ^ ^ ^
lo free limit hi
[X] allocated: in use
[_] committed: physical memory obtained
[.] uncommitted: mapped in virtual memory, not backed by memory
[X] allocated: in use
[_] committed: physical memory obtained
[.] uncommitted: mapped in virtual memory, not backed by memory
Allocation layout
.. code-block:: text
free_(pre)
v
<-------------z1--------------->
< guard >< hz >< req_z >< dz >< guard >
used <== +++++++++0000zzzz@@@@@@@@@@@@@@@@@ppppppp+++++++++ ==> avail
^ ^ ^
header mem |
^ |
last_header_ free_(post)
[+] guard after each allocation, for simple sanitize checks
[0] unused header bits (avail to application)
[z] record allocation size
[@] new allocated memory
[p] padding (to uintptr_t alignment)
Class
-----

View file

@ -1,5 +1,5 @@
/** @file Collector.hpp
*
*
* @author Roland Conybeare, Dec 2025
**/

View file

@ -6,7 +6,7 @@
#pragma once
#include "alloc/AllocHeaderConfig.hpp"
#include "alloc/AllocError.hpp"
//#include "alloc/AllocError.hpp"
#include <string>
#include <cstdint>

View file

@ -6,6 +6,7 @@
#pragma once
#include "ArenaConfig.hpp"
#include "alloc/AllocError.hpp"
#include "alloc/AllocInfo.hpp"
namespace xo {