Mercurial > hg > nginx
comparison src/core/ngx_buf.c @ 4114:5db098f97e0e
API change: ngx_chain_update_chains() now requires pool.
The ngx_chain_update_chains() needs pool to free chain links used for buffers
with non-matching tags. Providing one helps to reduce memory consumption
for long-lived requests.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 15 Sep 2011 16:03:17 +0000 |
parents | cc13ff6d5c07 |
children | d620f497c50f |
comparison
equal
deleted
inserted
replaced
4113:a28ba1cdec27 | 4114:5db098f97e0e |
---|---|
178 return cl; | 178 return cl; |
179 } | 179 } |
180 | 180 |
181 | 181 |
182 void | 182 void |
183 ngx_chain_update_chains(ngx_chain_t **free, ngx_chain_t **busy, | 183 ngx_chain_update_chains(ngx_pool_t *p, ngx_chain_t **free, ngx_chain_t **busy, |
184 ngx_chain_t **out, ngx_buf_tag_t tag) | 184 ngx_chain_t **out, ngx_buf_tag_t tag) |
185 { | 185 { |
186 ngx_chain_t *cl; | 186 ngx_chain_t *cl; |
187 | 187 |
188 if (*busy == NULL) { | 188 if (*busy == NULL) { |
195 } | 195 } |
196 | 196 |
197 *out = NULL; | 197 *out = NULL; |
198 | 198 |
199 while (*busy) { | 199 while (*busy) { |
200 if (ngx_buf_size((*busy)->buf) != 0) { | 200 cl = *busy; |
201 | |
202 if (ngx_buf_size(cl->buf) != 0) { | |
201 break; | 203 break; |
202 } | 204 } |
203 | 205 |
204 if ((*busy)->buf->tag != tag) { | 206 if (cl->buf->tag != tag) { |
205 *busy = (*busy)->next; | 207 *busy = cl->next; |
208 ngx_free_chain(p, cl); | |
206 continue; | 209 continue; |
207 } | 210 } |
208 | 211 |
209 (*busy)->buf->pos = (*busy)->buf->start; | 212 cl->buf->pos = cl->buf->start; |
210 (*busy)->buf->last = (*busy)->buf->start; | 213 cl->buf->last = cl->buf->start; |
211 | 214 |
212 cl = *busy; | |
213 *busy = cl->next; | 215 *busy = cl->next; |
214 cl->next = *free; | 216 cl->next = *free; |
215 *free = cl; | 217 *free = cl; |
216 } | 218 } |
217 } | 219 } |