<html><body><div>Hi,<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>I'm fairly new to the NGINX sources and have been studying ngx_array.c (from 1.9.5), particularly how the array grows when full.</div><div><br data-mce-bogus="1"></div><div>I'm having some confusion about how pool memory isn't leaked when the new array size can not fit within the current pool allocation and we call ngx_palloc(). The new allocation is assigned to the local variable new, which is eventually assigned to a->elts, but the old memory that was claimed out of the previous pool allocation (and tracked by a->elts) isn't released/marked as no longer used in the pool. I would have expected some manipulation of p->d.last, similarly to how ngx_array_destroy() releases the memory from the pool allocation. Is there something I'm not understanding about the way array uses the memory pool?</div><div><br data-mce-bogus="1"></div><div>It seems like over time an array that continues to grow (past the current pool allocation) would leave memory claimed within the pool allocation that it's no longer using or tracking<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div><a href="https://trac.nginx.org/nginx/browser/nginx/src/core/ngx_array.c">https://trac.nginx.org/nginx/browser/nginx/src/core/ngx_array.c</a></div><div><br data-mce-bogus="1"></div><div>Thanks,<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>Joel<br data-mce-bogus="1"></div></body></html>