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

Public 类型

using item_unique_ptr = unique_ptr< void, function< void(void *const)> >
 

Public 成员函数

 MemPoolItem (const char *tag)
 
int init (int item_size, bool dynamic=true, int pool_num=DEFAULT_POOL_NUM, int item_num_per_pool=DEFAULT_ITEM_NUM_PER_POOL)
 
void cleanup ()
 
int extend ()
 
void * alloc ()
 
item_unique_ptr alloc_unique_ptr ()
 
void free (void *item)
 
bool is_used (void *item)
 
string to_string ()
 
const string get_name () const
 
bool is_dynamic () const
 
int get_size () const
 
int get_item_size () const
 
int get_item_num_per_pool () const
 
int get_used_num ()
 

Protected 属性

pthread_mutex_t mutex
 
string name
 
bool dynamic
 
int size
 
int item_size
 
int item_num_per_pool
 
list< void * > pools
 
set< void * > used
 
list< void * > frees
 

成员函数说明

◆ alloc()

void * common::MemPoolItem::alloc ( )

Alloc one frame from memory Pool

返回

◆ cleanup()

void common::MemPoolItem::cleanup ( )

Do cleanup job for memory pool

◆ extend()

int common::MemPoolItem::extend ( )

If dynamic has been set, extend current memory pool,

◆ free()

void common::MemPoolItem::free ( void *  item)

Free one item, the resouce will return to memory Pool

参数
item

◆ init()

int common::MemPoolItem::init ( int  item_size,
bool  dynamic = true,
int  pool_num = DEFAULT_POOL_NUM,
int  item_num_per_pool = DEFAULT_ITEM_NUM_PER_POOL 
)

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.
返回

◆ is_used()

bool common::MemPoolItem::is_used ( void *  item)
inline

Check whether this item has been used before.

参数
item
返回

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