xo-alloc2: ++ docs

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

View file

@ -12,21 +12,44 @@ Context
.. ditaa:: .. ditaa::
:--scale: 0.99 :--scale: 0.99
+--------------------------------+ +-------------------------------+--------------------------------------+
| IAllocator_DArena | | | IAllocator_DX1Collector |
+--------------------------------+ | | IAllocIterator_DX1CollectorIterator |
| IAllocator_Xfer | | IAllocator_DArena | |
+--------------------------------+ | IAllocIterator_DArenaIterator +--------------------------------------+
| IAllocator_ImplType | | | DX1Collector |
+--------------+-----------------+ | | DX1CollectorIterator |
|cBLU | DArena | | | |
| AAllocator +-----------------+ +-------------------------------+---------+----------------------------+
| | ArenaConfig | | 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 .. code-block:: cpp
#incldue <xo/alloc2/AAllocator.hpp> #include <xo/alloc2/AAllocator.hpp>
Class Class
----- -----

View file

@ -28,21 +28,44 @@ Context
#include <xo/alloc2/DArena.hpp> #include <xo/alloc2/DArena.hpp>
Arena memory layout:: Arena memory layout
.. code-block:: text
<----------------------------size--------------------------> <----------------------------size-------------------------->
<------------committed-----------><-------uncommitted------> <------------committed-----------><-------uncommitted------>
<--allocated--> <--allocated-->
XXXXXXXXXXXXXXX___________________.......................... XXXXXXXXXXXXXXX___________________..........................
^ ^ ^ ^ ^ ^ ^ ^
lo free limit hi lo free limit hi
[X] allocated: in use [X] allocated: in use
[_] committed: physical memory obtained [_] committed: physical memory obtained
[.] uncommitted: mapped in virtual memory, not backed by memory [.] 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 Class
----- -----

View file

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

View file

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

View file

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