comparison src/core/ngx_palloc.c @ 605:5dac8c7fb71b release-0.3.24

nginx-0.3.24-RELEASE import *) Workaround: for bug in FreeBSD kqueue. *) Bugfix: now a response generated by the "post_action" directive is not transferred to a client. *) Bugfix: the memory leaks were occurring if many log files were used. *) Bugfix: the first "proxy_redirect" directive was working inside one location. *) Bugfix: on 64-bit platforms segmentation fault may occurred on start if the many names were used in the "server_name" directives; the bug had appeared in 0.3.18.
author Igor Sysoev <igor@sysoev.ru>
date Wed, 01 Feb 2006 18:22:15 +0000
parents d4e858a5751a
children 65bf042c0b4f
comparison
equal deleted inserted replaced
604:f4a6e8f250a8 605:5dac8c7fb71b
219 219
220 return p; 220 return p;
221 } 221 }
222 222
223 223
224 void *
225 ngx_shalloc(size_t size)
226 {
227 u_char *p;
228
229 if (size < sizeof(int) || (size & 1)) {
230 p = ngx_cycle->shm_last;
231
232 } else {
233 p = ngx_align_ptr(ngx_cycle->shm_last, NGX_ALIGNMENT);
234 }
235
236 if ((size_t) (ngx_cycle->shm_end - p) >= size) {
237 ngx_cycle->shm_last = p + size;
238 return p;
239 }
240
241 ngx_log_error(NGX_LOG_EMERG, ngx_cycle->log, 0,
242 "allocation of %uz bytes in shared memory failed, "
243 "only %uz are available",
244 size, ngx_cycle->shm_end - ngx_cycle->shm_last);
245
246 return NULL;
247 }
248
249
250 void *
251 ngx_shcalloc(size_t size)
252 {
253 void *p;
254
255 p = ngx_shalloc(size);
256 if (p) {
257 ngx_memzero(p, size);
258 }
259
260 return p;
261 }
262
263
224 ngx_pool_cleanup_t * 264 ngx_pool_cleanup_t *
225 ngx_pool_cleanup_add(ngx_pool_t *p, size_t size) 265 ngx_pool_cleanup_add(ngx_pool_t *p, size_t size)
226 { 266 {
227 ngx_pool_cleanup_t *c; 267 ngx_pool_cleanup_t *c;
228 268