Mercurial > hg > nginx
comparison src/core/ngx_alloc.c @ 10:4f3879d9b6f6
nginx-0.0.1-2002-09-11-19:18:33 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 11 Sep 2002 15:18:33 +0000 |
parents | b5481d6fbbd4 |
children | 53cb81681040 |
comparison
equal
deleted
inserted
replaced
9:6f58641241bb | 10:4f3879d9b6f6 |
---|---|
13 p = malloc(size); | 13 p = malloc(size); |
14 if (p == NULL) | 14 if (p == NULL) |
15 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, | 15 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, |
16 "malloc() %d bytes failed", size); | 16 "malloc() %d bytes failed", size); |
17 | 17 |
18 ngx_log_debug(log, "malloc: %x" _ p); | 18 ngx_log_debug(log, "malloc: %x:%d" _ p _ size); |
19 | 19 |
20 return p; | 20 return p; |
21 } | 21 } |
22 | 22 |
23 void *ngx_calloc(size_t size, ngx_log_t *log) | 23 void *ngx_calloc(size_t size, ngx_log_t *log) |
49 void ngx_destroy_pool(ngx_pool_t *pool) | 49 void ngx_destroy_pool(ngx_pool_t *pool) |
50 { | 50 { |
51 ngx_pool_t *p, *n; | 51 ngx_pool_t *p, *n; |
52 ngx_pool_large_t *l; | 52 ngx_pool_large_t *l; |
53 | 53 |
54 for (l = pool->large; l; l = l->next) | 54 for (l = pool->large; l; l = l->next) { |
55 ngx_log_debug(pool->log, "free: %x" _ l->alloc); | |
55 free(l->alloc); | 56 free(l->alloc); |
57 } | |
56 | 58 |
57 for (p = pool, n = pool->next; /* void */; p = n, n = n->next) { | 59 for (p = pool, n = pool->next; /* void */; p = n, n = n->next) { |
60 ngx_log_debug(pool->log, "free: %x" _ p); | |
58 free(p); | 61 free(p); |
59 | 62 |
60 if (n == NULL) | 63 if (n == NULL) |
61 break; | 64 break; |
62 } | 65 } |
108 } | 111 } |
109 | 112 |
110 if (large == NULL) { | 113 if (large == NULL) { |
111 ngx_test_null(large, ngx_palloc(pool, sizeof(ngx_pool_large_t)), | 114 ngx_test_null(large, ngx_palloc(pool, sizeof(ngx_pool_large_t)), |
112 NULL); | 115 NULL); |
116 large->next = NULL; | |
113 } | 117 } |
114 | 118 |
115 ngx_test_null(p, ngx_alloc(size, pool->log), NULL); | 119 ngx_test_null(p, ngx_alloc(size, pool->log), NULL); |
116 | 120 |
117 if (pool->large == NULL) { | 121 if (pool->large == NULL) { |