comparison src/os/unix/ngx_alloc.c @ 546:e19e5f542878 NGINX_0_8_25

nginx 0.8.25 *) Change: now no message is written in an error log if a variable is not found by $r->variable() method. *) Feature: the ngx_http_degradation_module. *) Feature: regular expression named captures. *) Feature: now URI part is not required a "proxy_pass" directive if variables are used. *) Feature: now the "msie_padding" directive works for Chrome too. *) Bugfix: a segmentation fault occurred in a worker process on low memory condition; the bug had appeared in 0.8.18. *) Bugfix: nginx sent gzipped responses to clients those do not support gzip, if "gzip_static on" and "gzip_vary off"; the bug had appeared in 0.8.16.
author Igor Sysoev <http://sysoev.ru>
date Mon, 16 Nov 2009 00:00:00 +0300
parents 6ae1357b7b7c
children ab7d265273ed
comparison
equal deleted inserted replaced
545:91e4b06e1a01 546:e19e5f542878
19 void *p; 19 void *p;
20 20
21 p = malloc(size); 21 p = malloc(size);
22 if (p == NULL) { 22 if (p == NULL) {
23 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, 23 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
24 "malloc() %uz bytes failed", size); 24 "malloc(%uz) failed", size);
25 } 25 }
26 26
27 ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0, "malloc: %p:%uz", p, size); 27 ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0, "malloc: %p:%uz", p, size);
28 28
29 return p; 29 return p;
49 49
50 void * 50 void *
51 ngx_memalign(size_t alignment, size_t size, ngx_log_t *log) 51 ngx_memalign(size_t alignment, size_t size, ngx_log_t *log)
52 { 52 {
53 void *p; 53 void *p;
54 int err;
54 55
55 if (posix_memalign(&p, alignment, size) == -1) { 56 err = posix_memalign(&p, alignment, size);
56 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, 57
57 "posix_memalign() %uz bytes aligned to %uz failed", 58 if (err) {
58 size, alignment); 59 ngx_log_error(NGX_LOG_EMERG, log, err,
60 "posix_memalign(%uz, %uz) failed", alignment, size);
61 p = NULL;
59 } 62 }
60 63
61 ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0, 64 ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0,
62 "posix_memalign: %p:%uz", p, size); 65 "posix_memalign: %p:%uz @%uz", p, size, alignment);
63 66
64 return p; 67 return p;
65 } 68 }
66 69
67 #elif (NGX_HAVE_MEMALIGN) 70 #elif (NGX_HAVE_MEMALIGN)
72 void *p; 75 void *p;
73 76
74 p = memalign(alignment, size); 77 p = memalign(alignment, size);
75 if (p == NULL) { 78 if (p == NULL) {
76 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, 79 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
77 "memalign() %uz bytes aligned to %uz failed", 80 "memalign(%uz, %uz) failed", alignment, size);
78 size, alignment);
79 } 81 }
80 82
81 ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0, 83 ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0,
82 "memalign: %p:%uz", p, size); 84 "memalign: %p:%uz @%uz", p, size, alignment);
83 85
84 return p; 86 return p;
85 } 87 }
86 88
87 #endif 89 #endif