[nginx] Core: use ngx_palloc_small() to allocate ngx_pool_large_t.

Valentin Bartenev vbart at nginx.com
Wed Mar 23 14:45:41 UTC 2016


details:   http://hg.nginx.org/nginx/rev/f61472978419
branches:  
changeset: 6454:f61472978419
user:      Valentin Bartenev <vbart at nginx.com>
date:      Wed Mar 23 17:44:04 2016 +0300
description:
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.

diffstat:

 src/core/ngx_palloc.c |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r 12248fe20689 -r f61472978419 src/core/ngx_palloc.c
--- a/src/core/ngx_palloc.c	Wed Mar 23 17:44:04 2016 +0300
+++ b/src/core/ngx_palloc.c	Wed Mar 23 17:44:04 2016 +0300
@@ -231,7 +231,7 @@ ngx_palloc_large(ngx_pool_t *pool, size_
         }
     }
 
-    large = ngx_palloc(pool, sizeof(ngx_pool_large_t));
+    large = ngx_palloc_small(pool, sizeof(ngx_pool_large_t), 1);
     if (large == NULL) {
         ngx_free(p);
         return NULL;
@@ -256,7 +256,7 @@ ngx_pmemalign(ngx_pool_t *pool, size_t s
         return NULL;
     }
 
-    large = ngx_palloc(pool, sizeof(ngx_pool_large_t));
+    large = ngx_palloc_small(pool, sizeof(ngx_pool_large_t), 1);
     if (large == NULL) {
         ngx_free(p);
         return NULL;



More information about the nginx-devel mailing list