nginx array utility pool usage

Ravi Chunduru ravivsn at
Fri Jan 17 02:38:51 UTC 2014

A little correction, a->pool is nothing to do with pool->current. But array
need to have a pointer to pool data of that of memory block that holds the
array elements. Then all checks done in ngx_array_push() etc., will be

On Thu, Jan 16, 2014 at 6:22 PM, Ravi Chunduru <ravivsn at> wrote:

> Hi Nginx experts,
>   Thanks for the prompt reply to my earlier email on ngx_reset_pool()
> Now, I am looking into ngx_array.c. I found an issue ngx_array_push().
> Here are the details.
> nginx will check if number of elements is equal to capacity of the array.
> If there is no space in the memory block, it allocates a new memory block
> with twice the size of array and copies over the elements. So far so good.
> Assume that pool utility got entirely new memory block then a->pool is not
> updated with that of  'pool->current'.
> I got an assumption from the code that a->pool is always the memory block
> that has the array elements by seeing the code in ngx_array_push(),
> ngx_array_push_n() or ngx_array_destroy() where checks were always done
> with pool pointer in array.
> Functionalities issues would come up once there is an array overflow. I
> think for every new push of element after first crossing/overflow of the
> capacity, nginx will keep on creating new array. Thus it results in wastage
> of memory.
> Please let me know if its a issue or correct my understanding.
> Thanks,
> --
> Ravi

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx-devel mailing list