Klaus Demo nginx / 5a2898f
try to reuse last 4 free large allocation links this fixes a pool growing for multi-requests keepalive connections Igor Sysoev 13 years ago
1 changed file(s) with 14 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
213213 ngx_palloc_large(ngx_pool_t *pool, size_t size)
214214 {
215215 void *p;
216 ngx_uint_t n;
216217 ngx_pool_large_t *large;
217218
218219 p = ngx_alloc(size, pool->log);
219220 if (p == NULL) {
220221 return NULL;
222 }
223
224 n = 0;
225
226 for (large = pool->large; large; large = large->next) {
227 if (large->alloc == NULL) {
228 large->alloc = p;
229 return p;
230 }
231
232 if (n++ > 3) {
233 break;
234 }
221235 }
222236
223237 large = ngx_palloc(pool, sizeof(ngx_pool_large_t));