comparison src/core/ngx_palloc.c @ 154:bb61aa162c6b NGINX_0_3_24

nginx 0.3.24 *) 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; bug appeared in 0.3.18.
author Igor Sysoev <http://sysoev.ru>
date Wed, 01 Feb 2006 00:00:00 +0300
parents 8e6d4d96ec4c
children 87699398f955
comparison
equal deleted inserted replaced
153:c73ae658b822 154:bb61aa162c6b
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