dl
dl_memory_pool.h 文件参考

基于引用计数的内存池 更多...

#include <list>
#include <cassert>
#include <functional>
#include <cstdlib>
#include "io/dl_log.h"
#include "math/dl_math.h"

浏览该文件的源代码.

struct  dl::GcRefInfo
 
class  dl::GC< T >
 引用计数对象,通过get_gc函数创建 更多...
 
class  dl::PoolList< T >
 内存池数据 更多...
 
class  dl::MemoryPool
 内存池 更多...
 

命名空间

namespace  dl
 

函数

template<typename T, typename... Args>
auto dl::get_gc (Args &&...args)
 定义一个GC变量(引用计数内存池)
 

变量

constexpr bool OUTPUT_DEBUG = true
 
constexpr bool OUTPUT_ADD = true
 
constexpr bool OUTPUT_MOVE = false
 
constexpr bool OUTPUT_STACK = false
 

详细描述

基于引用计数的内存池

版本
1.0
作者
lveyou
日期
21-08-30
注解
内存池修改为维护1个free列表和1个used列表
定期将used列表引用计数为0的移动回free列表
注意gc的类之间不要存在引用关系,不过也可以如下处理:
gcText包含gcSprite,我们使PoolList<gcText>先释放即可

在文件 dl_memory_pool.h 中定义.

变量说明

◆ OUTPUT_ADD

bool OUTPUT_ADD = true
constexpr

在文件 dl_memory_pool.h32 行定义.

◆ OUTPUT_DEBUG

bool OUTPUT_DEBUG = true
constexpr

在文件 dl_memory_pool.h31 行定义.

◆ OUTPUT_MOVE

bool OUTPUT_MOVE = false
constexpr

在文件 dl_memory_pool.h33 行定义.

◆ OUTPUT_STACK

bool OUTPUT_STACK = false
constexpr

在文件 dl_memory_pool.h34 行定义.