diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/ngx_palloc.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/core/ngx_palloc.c b/src/core/ngx_palloc.c index 3e1c9f2ad..a3f73f45e 100644 --- a/src/core/ngx_palloc.c +++ b/src/core/ngx_palloc.c @@ -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); |