# HG changeset patch # User Valentin Bartenev # Date 1458744244 -10800 # Node ID ad2360782ecd245dfa5428171a90bbba35bd7c55 # Parent f614729784194473aa3c546b1b6f099ec6ac831c Core: introduced the NGX_DEBUG_PALLOC macro. It allows to turn off accumulation of small pool allocations into a big preallocated chunk of memory. This is useful for debugging memory access with sanitizer, since such accumulation can cover buffer overruns from being detected. diff --git a/src/core/ngx_palloc.c b/src/core/ngx_palloc.c --- a/src/core/ngx_palloc.c +++ b/src/core/ngx_palloc.c @@ -122,9 +122,11 @@ ngx_reset_pool(ngx_pool_t *pool) void * ngx_palloc(ngx_pool_t *pool, size_t size) { +#if !(NGX_DEBUG_PALLOC) if (size <= pool->max) { return ngx_palloc_small(pool, size, 1); } +#endif return ngx_palloc_large(pool, size); } @@ -133,9 +135,11 @@ ngx_palloc(ngx_pool_t *pool, size_t size void * ngx_pnalloc(ngx_pool_t *pool, size_t size) { +#if !(NGX_DEBUG_PALLOC) if (size <= pool->max) { return ngx_palloc_small(pool, size, 0); } +#endif return ngx_palloc_large(pool, size); }