Mercurial > hg > nginx
changeset 2920:cb7d05c097db
do not test a pool block space if we can not allocated from the block 4 times
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 05 Jun 2009 13:27:12 +0000 |
parents | 41e7d9153967 |
children | e7278e647f1a |
files | src/core/ngx_palloc.c src/core/ngx_palloc.h |
diffstat | 2 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/core/ngx_palloc.c Fri Jun 05 12:33:49 2009 +0000 +++ b/src/core/ngx_palloc.c Fri Jun 05 13:27:12 2009 +0000 @@ -25,6 +25,7 @@ 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 @@ 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 @@ 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; } }