comparison src/core/ngx_palloc.c @ 498:207ae3ff0444 NGINX_0_8_1

nginx 0.8.1 *) Feature: the "updating" parameter in "proxy_cache_use_stale" and "fastcgi_cache_use_stale" directives. *) Bugfix: the "If-Modified-Since", "If-Range", etc. client request header lines were passed to backend while caching if no "proxy_set_header" directive was used with any parameters. *) Bugfix: the "Set-Cookie" and "P3P" response header lines were not hidden while caching if no "proxy_hide_header/fastcgi_hide_header" directives were used with any parameters. *) Bugfix: the ngx_http_image_filter_module did not support GIF87a format. Thanks to Denis Ilyinyh. *) Bugfix: nginx could not be built modules on Solaris 10 and early; the bug had appeared in 0.7.56.
author Igor Sysoev <http://sysoev.ru>
date Mon, 08 Jun 2009 00:00:00 +0400
parents c8cfb6c462ef
children f7ec98e3caeb
comparison
equal deleted inserted replaced
497:77fae36a61b3 498:207ae3ff0444
23 } 23 }
24 24
25 p->d.last = (u_char *) p + sizeof(ngx_pool_t); 25 p->d.last = (u_char *) p + sizeof(ngx_pool_t);
26 p->d.end = (u_char *) p + size; 26 p->d.end = (u_char *) p + size;
27 p->d.next = NULL; 27 p->d.next = NULL;
28 p->d.failed = 0;
28 29
29 size = size - sizeof(ngx_pool_t); 30 size = size - sizeof(ngx_pool_t);
30 p->max = (size < NGX_MAX_ALLOC_FROM_POOL) ? size : NGX_MAX_ALLOC_FROM_POOL; 31 p->max = (size < NGX_MAX_ALLOC_FROM_POOL) ? size : NGX_MAX_ALLOC_FROM_POOL;
31 32
32 p->current = p; 33 p->current = p;
187 188
188 new = (ngx_pool_t *) m; 189 new = (ngx_pool_t *) m;
189 190
190 new->d.end = m + psize; 191 new->d.end = m + psize;
191 new->d.next = NULL; 192 new->d.next = NULL;
193 new->d.failed = 0;
192 194
193 m += sizeof(ngx_pool_data_t); 195 m += sizeof(ngx_pool_data_t);
194 m = ngx_align_ptr(m, NGX_ALIGNMENT); 196 m = ngx_align_ptr(m, NGX_ALIGNMENT);
195 new->d.last = m + size; 197 new->d.last = m + size;
196 198
197 current = pool->current; 199 current = pool->current;
198 200
199 for (p = current; p->d.next; p = p->d.next) { 201 for (p = current; p->d.next; p = p->d.next) {
200 if ((size_t) (p->d.end - p->d.last) < NGX_ALIGNMENT) { 202 if (p->d.failed++ > 4) {
201 current = p->d.next; 203 current = p->d.next;
202 } 204 }
203 } 205 }
204 206
205 p->d.next = new; 207 p->d.next = new;
212 214
213 static void * 215 static void *
214 ngx_palloc_large(ngx_pool_t *pool, size_t size) 216 ngx_palloc_large(ngx_pool_t *pool, size_t size)
215 { 217 {
216 void *p; 218 void *p;
219 ngx_uint_t n;
217 ngx_pool_large_t *large; 220 ngx_pool_large_t *large;
218 221
219 p = ngx_alloc(size, pool->log); 222 p = ngx_alloc(size, pool->log);
220 if (p == NULL) { 223 if (p == NULL) {
221 return NULL; 224 return NULL;
225 }
226
227 n = 0;
228
229 for (large = pool->large; large; large = large->next) {
230 if (large->alloc == NULL) {
231 large->alloc = p;
232 return p;
233 }
234
235 if (n++ > 3) {
236 break;
237 }
222 } 238 }
223 239
224 large = ngx_palloc(pool, sizeof(ngx_pool_large_t)); 240 large = ngx_palloc(pool, sizeof(ngx_pool_large_t));
225 if (large == NULL) { 241 if (large == NULL) {
226 ngx_free(p); 242 ngx_free(p);