mirror of
https://github.com/nginx/nginx.git
synced 2024-12-13 02:39:00 +08:00
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
9af0c95f64
commit
5a2898f2b4
@ -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 New Issue
Block a user