iffl  1.3.4
Implements Intrusive Flat Forward List container
Classes | Public Member Functions | List of all members
iffl::debug_memory_resource Class Reference

implements std::pmr::memory_resource interface. More...

#include <iffl_allocator.h>

Inheritance diagram for iffl::debug_memory_resource:

Public Member Functions

 ~debug_memory_resource () noexcept
 Destructor triggers fail fast if there are outstanding allocations.
 
size_t get_busy_blocks_count () const noexcept
 Can be used to query number of outstanding allocations. More...
 
void validate_no_busy_blocks () const noexcept
 Triggers fail fast if there are outstanding allocations.
 

Detailed Description

implements std::pmr::memory_resource interface.

This class can be used with Polymorphic Memory Allocator. Forward Linked List has typedef for PMR called pmr_flat_forward_list.

Sample usage:

Code should guarantee that memory resource is destroyed after all memory allocated from this allocator is deallocated.

This class provides:

--------------------------------------------------------------------------------------------------------------------
|sizeof(size_t) bytes | pointer to | sizeof(size_t) prefix | user data | sizeof(size_t) suffix |
|offset to the end of | memory | 0xBEEFABCD - allocated block | filled with | 0xDEADABCD - allocated block |
|allocation | resource | 0xBEEFABCE - deallocated block | 0xFE | 0xDEADABCE - deallocated block |
--------------------------------------------------------------------------------------------------------------------

Member Function Documentation

◆ get_busy_blocks_count()

size_t iffl::debug_memory_resource::get_busy_blocks_count ( ) const
inlinenoexcept

Can be used to query number of outstanding allocations.

Returns
number of outstanding allocations

The documentation for this class was generated from the following file: