Aerospike partition tree的内存管理
来源:互联网 发布:js 定义全局变量赋值 编辑:程序博客网 时间:2024/05/26 14:09
as_namespaces_init:
1、uint32_t stage_capacity = as_mem_check() for (capacity = MAX_STAGE_CAPACITY; capacity >= MIN_STAGE_CAPACITY; capacity /= 2) { if (check_capacity(capacity)) { break; } }申请的内存大小以16M开始,如果内存大小不够用,则申请16/2M依次类推,最小大小是2M
2、as_namespaces_setup(cold_start_cmd, instance, stage_capacity); ->setup_namespace(g_config.namespaces[i], stage_capacity); ->ns->arena = (cf_arenax*)cf_malloc(cf_arenax_sizeof()); cf_arenax_err arena_result = cf_arenax_create(ns->arena, 0, as_index_size_get(ns), stage_capacity, 0, CF_ARENAX_BIGLOCK); ->uint64_t stage_size = (uint64_t)stage_capacity * sizeof(as_index); memset(this->stages, 0, sizeof(this->stages)); uint8_t* p_stage = (uint8_t*)cf_malloc(this->stage_size); this->stages[this->stage_count++] = p_stage; memset(cf_arenax_resolve(this, 0), 0, sizeof(as_index));ns->arena->stages[256]共有256个内存stage。
最开始,只申请对第一个stages申请16M*sizeof(as_index)的内存空间。
3、as_partition_init(ns, pid); ->p->vp = as_index_tree_create(&ns->tree_shared, ns->arena); ->tree->arena = arena;对partition进行初始化,树的内存都是共用一个arena,即ns->arena
run_index_tree_gc:线程回收tree的内存
1、从g_gc_queue队列中pop出回收的tree,然后调用as_index_tree_destroy函数回收
while (cf_queue_pop(&g_gc_queue, &tree, CF_QUEUE_FOREVER) == CF_QUEUE_OK) { as_index_tree_destroy(tree); }
2、递归调用as_index_sprig_traverse_purge进行回收
即将tree的每个element的handle回收到arena的free_h链表中
阅读全文
1 0
- Aerospike partition tree的内存管理
- Aerospike 的索引内存管理--as_index->dim
- Aerospike的bin内存管理--即列内存管理
- Aerospike 读写过程中对partition tree的引用计数的处理
- aerospike的安装
- partition管理
- Equal Tree Partition
- Oracle分区表 (Partition Table) 的创建及管理
- Oracle分区表 (Partition Table) 的创建及管理
- Linux文件系统之二:硬盘分区partition的组织和管理
- leetcode 663. Equal Tree Partition
- 基于Aerospike的用户数据管理系统实践
- 1.14 aerospike的设计与实现
- AeroSpike的python压测代码
- Aerospike rd记录的rec_props结构
- 内存管理--内存的简介
- Aerospike C客户端手册———共享内存
- aerospike工具集——AMC(管理控制台)
- find命令
- Mybatis高级映射多对多查询
- springMVC使用@ControllerAdvice实现异常处理
- 翘边阴影
- 鼠标右键 弹出属性对话框 QAction*cutAction
- Aerospike partition tree的内存管理
- OSI七层协议模型和TCP/IP四层模型
- 【Python】安装与测试
- 大学生学费(接口)
- 寻找正在连接中的网络连接
- 关于博客搬家的说明
- Java8学习笔记
- 培养整理的习惯
- 2017最后的机会:与100+顶尖科技商业领袖共话未来丨邀请函