xo-alloc2: + Allocator::alloc_info()
Also extend unit test
This commit is contained in:
parent
e369bc93f4
commit
ef8ec32a2d
15 changed files with 156 additions and 40 deletions
|
|
@ -88,6 +88,18 @@ namespace xo {
|
|||
/** get header from allocated object address **/
|
||||
header_type * obj2hdr(void * obj) noexcept;
|
||||
|
||||
/** report alloc book-keeping info for allocation at @p mem
|
||||
*
|
||||
* Require:
|
||||
* 1. @p mem is address returned by allocation on this arena
|
||||
* i.e. by @ref IAllocator_DArena::alloc() or @ref IAllocator_DArena::alloc_super()
|
||||
* 2. @p mem has not been invalidated since it was allocated
|
||||
* i.e. by call to @ref DArena::clear
|
||||
*
|
||||
* Note: non-const, may stash error details
|
||||
**/
|
||||
AllocInfo alloc_info(value_type mem) noexcept;
|
||||
|
||||
/** discard all allocated memory, return to empty state
|
||||
* Promise:
|
||||
* - committed memory unchanged
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ namespace xo {
|
|||
static bool contains(const DArena &, const void * p) noexcept;
|
||||
static AllocatorError last_error(const DArena &) noexcept;
|
||||
|
||||
/** retrieve allocation bookkeeping info for @p mem from arena @p d **/
|
||||
static AllocInfo alloc_info(DArena &, value_type mem) noexcept;
|
||||
/** expand committed space in arena @p d
|
||||
* to size at least @p z
|
||||
* In practice will round up to a multiple of @ref page_z_.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue