Mercurial > hg > nginx
comparison src/core/ngx_alloc.c @ 257:70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 11 Feb 2004 17:08:49 +0000 |
parents | 2357fa41738a |
children | 83205e0b5522 |
comparison
equal
deleted
inserted
replaced
256:8e39cab6abd5 | 257:70e1c7d2b83d |
---|---|
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() %d bytes failed", size); |
13 } | 13 } |
14 | 14 |
15 #if (NGX_DEBUG_ALLOC) | 15 ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0, "malloc: %08x:%d", p, size); |
16 ngx_log_debug(log, "malloc: %08x:%d" _ p _ size); | |
17 #endif | |
18 | 16 |
19 return p; | 17 return p; |
20 } | 18 } |
21 | 19 |
22 | 20 |
55 { | 53 { |
56 ngx_pool_t *p, *n; | 54 ngx_pool_t *p, *n; |
57 ngx_pool_large_t *l; | 55 ngx_pool_large_t *l; |
58 | 56 |
59 for (l = pool->large; l; l = l->next) { | 57 for (l = pool->large; l; l = l->next) { |
60 #if (NGX_DEBUG_ALLOC) | 58 |
61 ngx_log_debug(pool->log, "free: %08x" _ l->alloc); | 59 ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, pool->log, 0, |
62 #endif | 60 "free: %08x", l->alloc); |
61 | |
63 if (l->alloc) { | 62 if (l->alloc) { |
64 free(l->alloc); | 63 free(l->alloc); |
65 } | 64 } |
66 } | 65 } |
67 | 66 |
67 #if (NGX_DEBUG) | |
68 | |
68 /* | 69 /* |
69 * we could allocate pool->log from this pool | 70 * we could allocate the pool->log from this pool |
70 * so we can not use this log while free()ing the pool | 71 * so we can not use this log while the free()ing the pool |
71 */ | 72 */ |
72 | 73 |
73 #if (NGX_DEBUG_ALLOC) | |
74 for (p = pool, n = pool->next; /* void */; p = n, n = n->next) { | 74 for (p = pool, n = pool->next; /* void */; p = n, n = n->next) { |
75 ngx_log_debug(pool->log, "free: %08x" _ p); | 75 ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, pool->log, 0, "free: %08x", p); |
76 | 76 |
77 if (n == NULL) { | 77 if (n == NULL) { |
78 break; | 78 break; |
79 } | 79 } |
80 } | 80 } |
81 | |
81 #endif | 82 #endif |
82 | 83 |
83 for (p = pool, n = pool->next; /* void */; p = n, n = n->next) { | 84 for (p = pool, n = pool->next; /* void */; p = n, n = n->next) { |
84 free(p); | 85 free(p); |
85 | 86 |
175 { | 176 { |
176 ngx_pool_large_t *l; | 177 ngx_pool_large_t *l; |
177 | 178 |
178 for (l = pool->large; l; l = l->next) { | 179 for (l = pool->large; l; l = l->next) { |
179 if (p == l->alloc) { | 180 if (p == l->alloc) { |
180 #if (NGX_DEBUG_ALLOC) | 181 ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, pool->log, 0, |
181 ngx_log_debug(pool->log, "free: %08x" _ l->alloc); | 182 "free: %08x", l->alloc); |
182 #endif | |
183 free(l->alloc); | 183 free(l->alloc); |
184 l->alloc = NULL; | 184 l->alloc = NULL; |
185 } | 185 } |
186 } | 186 } |
187 } | 187 } |