nginx动态数组中自动扩容的实现问题

为了方便阐述我的问题,我举个例子:
ngx_array_t *manager = ngx_array_create( cf->pool,1,sizeof(Node) );

在ngx_array_create的实现中,将manager的成员pool置为cf->pool; 大家知道,如果cf->pool当前内存空间不够,就会再生成另一个内存节点,那么manager可能指向的是另一个内存池节点分配的内存;

继续,关于ngx_array_push自动扩容问题的实现(我不理解的地方);
下面是实现代码:
void *
ngx_array_push(ngx_array_t *a)
{
void *elt, *new;
size_t size;
ngx_pool_t *p;

if (a->nelts == a->nalloc) {

    /* the array is full */

    size = a->size * a->nalloc;

    p = a->pool;

    if ((u_char *) a->elts + size == p->d.last   
        && p->d.last + a->size <= p->d.end) /*为什么认定当初分配的动态数组的数据区就是在cf->pool*/
    {
        /*
         * the array allocation is the last in the pool
         * and there is space for new allocation
         */

        p->d.last += a->size;
        a->nalloc++;

    } else {
        /* allocate a new array */

        new = ngx_palloc(p, 2 * size);
        if (new == NULL) {
            return NULL;
        }

        ngx_memcpy(new, a->elts, size);
        a->elts = new;
        a->nalloc *= 2;
    }
}
。。。

}

不好意思,我没有积分。。。

pool里面本身也还都是指针吧,空间不够也还是在其他地方分配,然后修改指针。s所有还是用pool