MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
Public 成员函数 | Protected 属性 | Private 成员函数 | 所有成员列表
common::MemPoolSimple< T > 模板类 参考

#include <mem_pool.h>

类 common::MemPoolSimple< T > 继承关系图:
common::MemPool< T >

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)
 

详细描述

template<class T>
class common::MemPoolSimple< T >

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

成员函数说明

◆ alloc()

template<class T >
T * common::MemPoolSimple< T >::alloc
virtual

Alloc one frame from memory Pool

返回

实现了 common::MemPool< T >.

◆ cleanup()

template<class T >
void common::MemPoolSimple< T >::cleanup
virtual

Do cleanup job for memory pool

实现了 common::MemPool< T >.

◆ extend()

template<class T >
int common::MemPoolSimple< T >::extend
virtual

If dynamic has been set, extend current memory pool,

实现了 common::MemPool< T >.

◆ free()

template<class T >
void common::MemPoolSimple< T >::free ( T *  item)
virtual

Free one item, the resouce will return to memory Pool

参数
item

实现了 common::MemPool< T >.

◆ init()

template<class T >
int common::MemPoolSimple< T >::init ( bool  dynamic = true,
int  pool_num = DEFAULT_POOL_NUM,
int  item_num_per_pool = DEFAULT_ITEM_NUM_PER_POOL 
)
virtual

init memory pool, the major job is to alloc memory for memory pool

参数
pool_num,memorypool's number
item_num_per_pool,howmany items per pool.
返回
0 for success and others failure

实现了 common::MemPool< T >.

◆ to_string()

template<class T >
string common::MemPoolSimple< T >::to_string
virtual

Print the MemPool status

返回

实现了 common::MemPool< T >.


该类的文档由以下文件生成: