Mercurial > hg > nginx
comparison src/core/ngx_palloc.c @ 5521:320abeb364e6
Core: improved ngx_reset_pool() (ticket #490).
Previously pool->current wasn't moved back to pool, resulting in blocks
not used for further allocations if pool->current was already moved at the
time of ngx_reset_pool(). Additionally, to preserve logic of moving
pool->current, the p->d.failed counters are now properly cleared. While
here, pool->chain is also cleared.
This change is essentially a nop with current code, but generally improves
things.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 17 Jan 2014 06:24:53 +0400 |
parents | d620f497c50f |
children | c45c9812cf11 |
comparison
equal
deleted
inserted
replaced
5520:a336cbc3dd44 | 5521:320abeb364e6 |
---|---|
103 if (l->alloc) { | 103 if (l->alloc) { |
104 ngx_free(l->alloc); | 104 ngx_free(l->alloc); |
105 } | 105 } |
106 } | 106 } |
107 | 107 |
108 pool->large = NULL; | |
109 | |
110 for (p = pool; p; p = p->d.next) { | 108 for (p = pool; p; p = p->d.next) { |
111 p->d.last = (u_char *) p + sizeof(ngx_pool_t); | 109 p->d.last = (u_char *) p + sizeof(ngx_pool_t); |
112 } | 110 p->d.failed = 0; |
111 } | |
112 | |
113 pool->current = pool; | |
114 pool->chain = NULL; | |
115 pool->large = NULL; | |
113 } | 116 } |
114 | 117 |
115 | 118 |
116 void * | 119 void * |
117 ngx_palloc(ngx_pool_t *pool, size_t size) | 120 ngx_palloc(ngx_pool_t *pool, size_t size) |