aboutsummaryrefslogtreecommitdiff
path: root/src/core/ngx_palloc.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2009-06-05 13:27:12 +0000
committerIgor Sysoev <igor@sysoev.ru>2009-06-05 13:27:12 +0000
commit7f9305cc2c9bc7b9ecda91508c041bd2fca5c0b6 (patch)
tree5df98e9904c16a663c6402081e413cea20d0ad16 /src/core/ngx_palloc.c
parent8e5f0acbc2ea99fe80e38479590ec6fec67b3916 (diff)
downloadnginx-7f9305cc2c9bc7b9ecda91508c041bd2fca5c0b6.tar.gz
nginx-7f9305cc2c9bc7b9ecda91508c041bd2fca5c0b6.zip
do not test a pool block space if we can not allocated from the block 4 times
Diffstat (limited to 'src/core/ngx_palloc.c')
-rw-r--r--src/core/ngx_palloc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/core/ngx_palloc.c b/src/core/ngx_palloc.c
index a3f73f45e..fd0476803 100644
--- a/src/core/ngx_palloc.c
+++ b/src/core/ngx_palloc.c
@@ -25,6 +25,7 @@ ngx_create_pool(size_t size, ngx_log_t *log)
p->d.last = (u_char *) p + sizeof(ngx_pool_t);
p->d.end = (u_char *) p + size;
p->d.next = NULL;
+ p->d.failed = 0;
size = size - sizeof(ngx_pool_t);
p->max = (size < NGX_MAX_ALLOC_FROM_POOL) ? size : NGX_MAX_ALLOC_FROM_POOL;
@@ -189,6 +190,7 @@ ngx_palloc_block(ngx_pool_t *pool, size_t size)
new->d.end = m + psize;
new->d.next = NULL;
+ new->d.failed = 0;
m += sizeof(ngx_pool_data_t);
m = ngx_align_ptr(m, NGX_ALIGNMENT);
@@ -197,7 +199,7 @@ ngx_palloc_block(ngx_pool_t *pool, size_t size)
current = pool->current;
for (p = current; p->d.next; p = p->d.next) {
- if ((size_t) (p->d.end - p->d.last) < NGX_ALIGNMENT) {
+ if (p->d.failed++ > 4) {
current = p->d.next;
}
}