1、
每个基于NGX_CORE_MODULE模块的新类型模块一开始从内存池获得内存。
那么内存池在哪分配的呢?
来自cf->pool
2、
ngx_http_core_moudle模块变量定义时会给下面【函数指针】设置回调函数的
create_main_conf create_srv_confcreate_loc_conf
回调函数的功能是为存储配置项的结构体分配内存并返回指向该结构体的指针
ngx_http_core_main_conf_t ngx_http_core_srv_conf_t ngx_http_core_loc_conf_t
3、
ngx_http_moudle模块中
ngx_http_conf_ctx_t结构体为
typedef struct {
void **main_conf;//main_conf数组存放ngx_http_max_module个指针, 每一个指针则指向一个对应的HTTP模块指针的函数指针 create_main_c
每个基于NGX_CORE_MODULE模块的新类型模块一开始从内存池获得内存。
那么内存池在哪分配的呢?
来自cf->pool
2、
ngx_http_core_moudle模块变量定义时会给下面【函数指针】设置回调函数的
create_main_conf create_srv_confcreate_loc_conf
回调函数的功能是为存储配置项的结构体分配内存并返回指向该结构体的指针
ngx_http_core_main_conf_t ngx_http_core_srv_conf_t ngx_http_core_loc_conf_t
3、
ngx_http_moudle模块中
ngx_http_conf_ctx_t结构体为
typedef struct {
void **main_conf;//main_conf数组存放ngx_http_max_module个指针, 每一个指针则指向一个对应的HTTP模块指针的函数指针 create_main_c