Class Allocator
- Defined in File allocator.h 
Class Documentation
- 
class Allocator
- Allocator defined a memory pool for malloc memory and free memory dynamically. - Public Functions - 
virtual void *Malloc(size_t size) = 0
- Method to request memory. - 参数
- size – [in] Define the memory size to request. 
 
 - 
inline virtual void *Malloc(size_t weight, size_t height, DataType type)
- Method to request memory. - 参数
- weight – [in] Defines the width of memory to request 
- height – [in] Defines the height of memory to request 
- type – [in] Defines the data type of memory to request 
 
 
 - 
virtual void Free(void *ptr) = 0
- Method to free memory. - 参数
- ptr – [in] Define the pointer of a certain memory. 
 
 - 
virtual int RefCount(void *ptr) = 0
- Reference count of a certain memory. - 参数
- ptr – [in] Define the pointer of a certain memory. 
- 返回
- Reference count of a certain memory currently. 
 
 - 
virtual int SetRefCount(void *ptr, int ref_count) = 0
- Set reference count of a certain memory. - 参数
- ptr – [in] Define the pointer of a certain memory. 
- ref_count – [in] Define the reference count to set. 
 
- 返回
- Reference count of a certain memory after setting. 
 
 - 
virtual int DecRefCount(void *ptr, int ref_count) = 0
- Decrease the reference count of a certain memory. - 参数
- ptr – [in] Define the pointer of a certain memory. 
- ref_count – [in] Define the reference count to reduce. 
 
- 返回
- Reference count of a certain memory after decreating. 
 
 - 
virtual int IncRefCount(void *ptr, int ref_count) = 0
- Increase the reference count of a certain memory. - 参数
- ptr – [in] Define the pointer of a certain memory. 
- ref_count – [in] Define the reference count to increase. 
 
- 返回
- Reference count of a certain memory after increasing. 
 
 - 
inline virtual void *Prepare(void *ptr)
- Prepare a certain memory. - 参数
- ptr – [in] Define the pointer of a certain memory to prepare. 
- 返回
- Pointer of ready memory. 
 
 
- 
virtual void *Malloc(size_t size) = 0