MySQL 8.0.39
Source Code Documentation
|
Allocate the memory for the object in blocks. More...
#include <ut0pool.h>
Classes | |
struct | Element |
Public Types | |
typedef Type | value_type |
Public Member Functions | |
Pool (size_t size) | |
Constructor. More... | |
~Pool () | |
Destructor. More... | |
Type * | get () |
Get an object from the pool. More... | |
Static Public Member Functions | |
static void | mem_free (value_type *ptr) |
Add the object to the pool. More... | |
Protected Member Functions | |
Pool (const Pool &) | |
Pool & | operator= (const Pool &) |
Private Types | |
typedef std::priority_queue< Element *, std::vector< Element *, ut::allocator< Element * > >, std::greater< Element * > > | pqueue_t |
Private Member Functions | |
void | put (Element *elem) |
Release the object to the free pool. More... | |
void | init (size_t n_elems) |
Initialise the elements. More... | |
Private Attributes | |
Element * | m_end |
Pointer to the last element. More... | |
Element * | m_start |
Pointer to the first element. More... | |
size_t | m_size |
Size of the block in bytes. More... | |
Element * | m_last |
Upper limit of used space. More... | |
pqueue_t | m_pqueue |
Priority queue ordered on the pointer addresses. More... | |
LockStrategy | m_lock_strategy |
Lock strategy to use. More... | |
Allocate the memory for the object in blocks.
We keep the objects sorted on pointer so that they are closer together in case they have to be iterated over in a list.
|
private |
typedef Type Pool< Type, Factory, LockStrategy >::value_type |
|
inline |
Constructor.
size | size of the memory block |
|
inline |
Destructor.
|
protected |
|
inline |
Get an object from the pool.
|
inlineprivate |
Initialise the elements.
n_elems | Number of elements to initialise |
|
inlinestatic |
Add the object to the pool.
ptr | object to free |
|
protected |
|
inlineprivate |
Release the object to the free pool.
elem | element to free |
|
private |
Pointer to the last element.
|
private |
Upper limit of used space.
|
private |
Lock strategy to use.
|
private |
Priority queue ordered on the pointer addresses.
|
private |
Size of the block in bytes.
|
private |
Pointer to the first element.