comparison src/core/ngx_alloc.c @ 267:83205e0b5522

nginx-0.0.2-2004-02-24-20:31:46 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 24 Feb 2004 17:31:46 +0000
parents 70e1c7d2b83d
children ee394e997c77
comparison
equal deleted inserted replaced
266:5238e93961a1 267:83205e0b5522
7 { 7 {
8 void *p; 8 void *p;
9 9
10 if (!(p = malloc(size))) { 10 if (!(p = malloc(size))) {
11 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, 11 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
12 "malloc() %d bytes failed", size); 12 "malloc() " SIZE_T_FMT " bytes failed", size);
13 } 13 }
14 14
15 ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0, "malloc: %08x:%d", p, size); 15 ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0,
16 "malloc: " PTR_FMT ":" SIZE_T_FMT, p, size);
16 17
17 return p; 18 return p;
18 } 19 }
19 20
20 21
55 ngx_pool_large_t *l; 56 ngx_pool_large_t *l;
56 57
57 for (l = pool->large; l; l = l->next) { 58 for (l = pool->large; l; l = l->next) {
58 59
59 ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, pool->log, 0, 60 ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, pool->log, 0,
60 "free: %08x", l->alloc); 61 "free: " PTR_FMT, l->alloc);
61 62
62 if (l->alloc) { 63 if (l->alloc) {
63 free(l->alloc); 64 free(l->alloc);
64 } 65 }
65 } 66 }
70 * we could allocate the pool->log from this pool 71 * we could allocate the pool->log from this pool
71 * so we can not use this log while the free()ing the pool 72 * so we can not use this log while the free()ing the pool
72 */ 73 */
73 74
74 for (p = pool, n = pool->next; /* void */; p = n, n = n->next) { 75 for (p = pool, n = pool->next; /* void */; p = n, n = n->next) {
75 ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, pool->log, 0, "free: %08x", p); 76 ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, pool->log, 0,
77 "free: " PTR_FMT, p);
76 78
77 if (n == NULL) { 79 if (n == NULL) {
78 break; 80 break;
79 } 81 }
80 } 82 }
177 ngx_pool_large_t *l; 179 ngx_pool_large_t *l;
178 180
179 for (l = pool->large; l; l = l->next) { 181 for (l = pool->large; l; l = l->next) {
180 if (p == l->alloc) { 182 if (p == l->alloc) {
181 ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, pool->log, 0, 183 ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, pool->log, 0,
182 "free: %08x", l->alloc); 184 "free: " PTR_FMT, l->alloc);
183 free(l->alloc); 185 free(l->alloc);
184 l->alloc = NULL; 186 l->alloc = NULL;
185 } 187 }
186 } 188 }
187 } 189 }