comparison src/core/ngx_palloc.c @ 6454:f61472978419

Core: use ngx_palloc_small() to allocate ngx_pool_large_t. This structure cannot be allocated as a large block anyway, otherwise that will result in infinite recursion, since each large allocation requires to allocate another ngx_pool_large_t. The room for the structure is guaranteed by the NGX_MIN_POOL_SIZE constant.
author Valentin Bartenev <vbart@nginx.com>
date Wed, 23 Mar 2016 17:44:04 +0300
parents 12248fe20689
children ad2360782ecd
comparison
equal deleted inserted replaced
6453:12248fe20689 6454:f61472978419
229 if (n++ > 3) { 229 if (n++ > 3) {
230 break; 230 break;
231 } 231 }
232 } 232 }
233 233
234 large = ngx_palloc(pool, sizeof(ngx_pool_large_t)); 234 large = ngx_palloc_small(pool, sizeof(ngx_pool_large_t), 1);
235 if (large == NULL) { 235 if (large == NULL) {
236 ngx_free(p); 236 ngx_free(p);
237 return NULL; 237 return NULL;
238 } 238 }
239 239
254 p = ngx_memalign(alignment, size, pool->log); 254 p = ngx_memalign(alignment, size, pool->log);
255 if (p == NULL) { 255 if (p == NULL) {
256 return NULL; 256 return NULL;
257 } 257 }
258 258
259 large = ngx_palloc(pool, sizeof(ngx_pool_large_t)); 259 large = ngx_palloc_small(pool, sizeof(ngx_pool_large_t), 1);
260 if (large == NULL) { 260 if (large == NULL) {
261 ngx_free(p); 261 ngx_free(p);
262 return NULL; 262 return NULL;
263 } 263 }
264 264