nginx array utility pool usage

Ravi Chunduru ravivsn at gmail.com
Fri Jan 17 02:22:58 UTC 2014


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: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20140116/ac6e2692/attachment.html>


More information about the nginx-devel mailing list