apr内存池阅读笔记-结构体说明
来源:互联网 发布:直销软件开发制作 编辑:程序博客网 时间:2024/05/29 03:18
以注释的方式记录一下,方便自己回头学习与使用。
如有错误或者建议欢迎留言。
分配器allocator
struct apr_allocator_t { apr_uint32_t max_index;//分配器包含的最大节点内存大小 apr_uint32_t max_free_index;//分配器能包含的最大内存 apr_uint32_t current_free_index;//分配器当前还能接收的内存大小#if APR_HAS_THREADS apr_thread_mutex_t *mutex;//锁,支持线程安全。#endif /* APR_HAS_THREADS */ apr_pool_t *owner;//所属的内存池 /** 节点链表数组,数组索引代表了节点链表中的节点内存大小。 free[0]保存的大小是大于MAX_INDEX(这是个宏,不是分配器的成员变量,默认为20。)的节点。 数组结构如下: free[0]:size 大于20*BOUNDARY_SIZE free[1]:size (1+1)*BOUNDARY_SIZE 8192 free[2]:size (2+1)*BOUNDARY_SIZE 12288 ... free[19]:size (19+1)*BOUNDARY_SIZE 81920 */ apr_memnode_t *free[MAX_INDEX];};
节点memnode
struct apr_memnode_t { apr_memnode_t *next; //下一个节点 apr_memnode_t **ref; //指向的是链表中上一个节点的next指针 apr_uint32_t index; //节点的内存大小 apr_uint32_t free_index; //空闲内存大小 char *first_avail; //空闲内存起始地址 char *endp; //空闲内存结束地址};
内存池pool
struct apr_pool_t { apr_pool_t *parent;//父内存池 apr_pool_t *child;//子内存池 apr_pool_t *sibling;//兄弟内存池 apr_pool_t **ref;//指向在兄弟链中的上一个内存池 cleanup_t *cleanups;//清理函数相关,可以注册自定义清理函数。 cleanup_t *free_cleanups; apr_allocator_t *allocator;//内存池使用的分配器 struct process_chain *subprocesses; apr_abortfunc_t abort_fn;//可自定义出错时的处理函数,如申请的内存大小非法,系统内存不足等错误。 apr_hash_t *user_data;//hashmap可以存放自定义的键值对 const char *tag;//一个字符串标识,在日志中可以起到标识作用。#if !APR_POOL_DEBUG apr_memnode_t *active;//活跃节点(已使用的节点)链表 apr_memnode_t *self; //内存池本身所在的节点 char *self_first_avail;//内存池本身所在的节点的空闲内存起始地址#else /* APR_POOL_DEBUG */ apr_pool_t *joined; /* the caller has guaranteed that this pool * will survive as long as ->joined */ debug_node_t *nodes; const char *file_line; apr_uint32_t creation_flags; unsigned int stat_alloc; unsigned int stat_total_alloc; unsigned int stat_clear;#if APR_HAS_THREADS apr_os_thread_t owner;//所属线程 apr_thread_mutex_t *mutex;//锁#endif /* APR_HAS_THREADS */#endif /* APR_POOL_DEBUG */#ifdef NETWARE apr_os_proc_t owner_proc;#endif /* defined(NETWARE) */ cleanup_t *pre_cleanups;};
0 0
- apr内存池阅读笔记-结构体说明
- apr HashTable源码阅读笔记
- apr内存池
- [转]apr内存池
- apr内存池
- APR-内存池
- APR 内存池
- apr研究-内存池-1
- C/C++ 结构体的内存结构说明
- APR内存池的创建与销毁
- apr-pool 内存池测试用例
- APR内存池的学习与实现
- Nginx 源码阅读笔记1 内存池
- apr安装说明
- spark说明手册阅读笔记
- 对于结构体中内存对齐的简单说明
- MPC8641d内存映射阅读笔记
- JVM内存详解-阅读笔记
- 解决VS2008读execl出现:服务器出现意外情况 问题
- 排序算法(十一) 基数排序
- 统计字符出现的次数。2016-10-27
- C++中多线程编程之volatile分析
- Android Volley完全解析(四),带你从源码的角度理解Volley
- apr内存池阅读笔记-结构体说明
- 部分枚举(遥远的银河,LA 3695)
- 【转】String 0GC实现方法
- Python 中的类
- 科大讯飞语音识别
- 使用MyEclipse整合ssh(Struts、Spring、Hibernate)三大框架(环境搭载+实例源码下载)
- Android中使用http实现注册登录
- java 软引用和弱引用
- setting.xml详解