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

@ -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
-----