|
MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
|
#include <mem_pool.h>
Public 成员函数 | |
| MemPoolSimple (const char *tag) | |
| int | init (bool dynamic=true, int pool_num=DEFAULT_POOL_NUM, int item_num_per_pool=DEFAULT_ITEM_NUM_PER_POOL) |
| void | cleanup () |
| int | extend () |
| T * | alloc () |
| void | free (T *item) |
| string | to_string () |
| int | get_item_num_per_pool () const |
| int | get_used_num () |
Public 成员函数 继承自 common::MemPool< T > | |
| MemPool (const char *tag) | |
| virtual int | init (bool dynamic=true, int pool_num=DEFAULT_POOL_NUM, int item_num_per_pool=DEFAULT_ITEM_NUM_PER_POOL)=0 |
| virtual void | cleanup ()=0 |
| virtual int | extend ()=0 |
| virtual T * | alloc ()=0 |
| virtual void | free (T *item)=0 |
| virtual string | to_string ()=0 |
| const string | get_name () const |
| bool | is_dynamic () const |
| int | get_size () const |
Protected 属性 | |
| list< T * > | pools |
| set< T * > | used |
| list< T * > | frees |
| int | item_num_per_pool |
Protected 属性 继承自 common::MemPool< T > | |
| pthread_mutex_t | mutex |
| int | size |
| bool | dynamic |
| string | name |
Private 成员函数 | |
| void | asan_poison (void *addr, size_t size) |
| void | asan_unpoison (void *addr, size_t size) |
MemoryPoolSimple is a simple Memory Pool manager The objects is constructed when creating the pool and destructed when the pool is cleanup. alloc calls T's reinit routine and free calls T's reset
|
virtual |
|
virtual |
Do cleanup job for memory pool
实现了 common::MemPool< T >.
|
virtual |
If dynamic has been set, extend current memory pool,
实现了 common::MemPool< T >.
|
virtual |
|
virtual |
init memory pool, the major job is to alloc memory for memory pool
| pool_num,memory | pool's number |
| item_num_per_pool,how | many items per pool. |
实现了 common::MemPool< T >.
|
virtual |