try to reuse last 4 free large allocation links
this fixes a pool growing for multi-requests keepalive connections
This commit is contained in:
parent
d15561923c
commit
5addd428b5
1 changed files with 14 additions and 0 deletions
|
@ -214,6 +214,7 @@ static void *
|
|||
ngx_palloc_large(ngx_pool_t *pool, size_t size)
|
||||
{
|
||||
void *p;
|
||||
ngx_uint_t n;
|
||||
ngx_pool_large_t *large;
|
||||
|
||||
p = ngx_alloc(size, pool->log);
|
||||
|
@ -221,6 +222,19 @@ ngx_palloc_large(ngx_pool_t *pool, size_t size)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
n = 0;
|
||||
|
||||
for (large = pool->large; large; large = large->next) {
|
||||
if (large->alloc == NULL) {
|
||||
large->alloc = p;
|
||||
return p;
|
||||
}
|
||||
|
||||
if (n++ > 3) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
large = ngx_palloc(pool, sizeof(ngx_pool_large_t));
|
||||
if (large == NULL) {
|
||||
ngx_free(p);
|
||||
|
|
Loading…
Reference in a new issue