The problem of nginx creating a memory pool

ngx_pool_t *
ngx_create_pool (size_t size, ngx_log_t * log)
{

ngx_pool_t  *p;

p = ngx_memalign(NGX_POOL_ALIGNMENT, size, log);
if (p == NULL) {
    return NULL;
}

p->d.last = (u_char *) p + sizeof(ngx_pool_t);
p->d.end = (u_char *) p + size;
p->d.next = NULL;
p->d.failed = 0;

size = size - sizeof(ngx_pool_t);
p->max = (size < NGX_MAX_ALLOC_FROM_POOL) ? size : NGX_MAX_ALLOC_FROM_POOL;

p->current = p;
p->chain = NULL;
p->large = NULL;
p->cleanup = NULL;
p->log = log;

return p;

}

as above, NGX_MAX_ALLOC_FROM_POOL, NGX_MAX_ALLOC_FROM_POOL is ngx_pagesize-1
used in ngx_create_pool, but looking at the nginx code, ngx_pagesize was not assigned the first time it crossed the memory pool. Is there a problem?

Feb.24,2022
The

ngx_pagesize global variable is initialized to 0 by default

Menu