diff options
author | Valentin Bartenev <vbart@nginx.com> | 2016-03-23 17:44:04 +0300 |
---|---|---|
committer | Valentin Bartenev <vbart@nginx.com> | 2016-03-23 17:44:04 +0300 |
commit | 0f4315f998bfedbd478c8215994414f1526bfd40 (patch) | |
tree | 8b19296108bd9b8d8622f8805b10675b8fb0295b /src/core/ngx_palloc.c | |
parent | 9d08bda415b9c987b7a3503bf5fa45cfda15df2e (diff) | |
download | nginx-0f4315f998bfedbd478c8215994414f1526bfd40.tar.gz nginx-0f4315f998bfedbd478c8215994414f1526bfd40.zip |
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.
Diffstat (limited to 'src/core/ngx_palloc.c')
-rw-r--r-- | src/core/ngx_palloc.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/ngx_palloc.c b/src/core/ngx_palloc.c index 91e7cd71c..d3044ac9c 100644 --- 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); } |