Changeset 69 for pjproject/trunk/pjlib/src/pj/pool.c
- Timestamp:
- Nov 21, 2005 4:58:03 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/pool.c
r66 r69 46 46 47 47 LOG((pool->obj_name, "create_block(sz=%u), cur.cap=%u, cur.used=%u", 48 size, pool->capacity, p ool->used_size));48 size, pool->capacity, pj_pool_get_used_size(pool))); 49 49 50 50 /* Request memory from allocator. */ … … 58 58 /* Add capacity. */ 59 59 pool->capacity += size; 60 pool->used_size += sizeof(pj_pool_block);61 60 62 61 /* Set block attribytes. */ … … 87 86 88 87 while (block != &pool->block_list) { 89 p = pj_pool_alloc_from_block( pool,block, size);88 p = pj_pool_alloc_from_block(block, size); 90 89 if (p != NULL) 91 90 return p; … … 98 97 LOG((pool->obj_name, "Can't expand pool to allocate %u bytes " 99 98 "(used=%u, cap=%u)", 100 size, p ool->used_size, pool->capacity));99 size, pj_pool_get_used_size(pool), pool->capacity)); 101 100 (*pool->callback)(pool, size); 102 101 return NULL; … … 119 118 LOG((pool->obj_name, 120 119 "%u bytes requested, resizing pool by %u bytes (used=%u, cap=%u)", 121 size, block_size, p ool->used_size, pool->capacity));120 size, block_size, pj_pool_get_used_size(pool), pool->capacity)); 122 121 123 122 block = pj_pool_create_block(pool, block_size); … … 125 124 return NULL; 126 125 127 p = pj_pool_alloc_from_block( pool,block, size);126 p = pj_pool_alloc_from_block(block, size); 128 127 pj_assert(p != NULL); 129 128 #if PJ_DEBUG … … 143 142 pj_pool_callback *callback) 144 143 { 145 pj_pool_block *block;146 147 144 PJ_CHECK_STACK(); 148 145 149 146 pool->increment_size = increment_size; 150 147 pool->callback = callback; 151 pool->used_size = sizeof(*pool);152 block = pool->block_list.next;153 while (block != &pool->block_list) {154 pool->used_size += sizeof(pj_pool_block);155 block = block->next;156 }157 148 158 149 if (name) { … … 238 229 block->cur = block->buf; 239 230 pool->capacity = block->end - (unsigned char*)pool; 240 pool->used_size = 0;241 231 } 242 232 … … 247 237 { 248 238 LOG((pool->obj_name, "reset(): cap=%d, used=%d(%d%%)", 249 pool->capacity, pool->used_size, pool->used_size*100/pool->capacity)); 239 pool->capacity, pj_pool_get_used_size(pool), 240 pj_pool_get_used_size(pool)*100/pool->capacity)); 250 241 251 242 reset_pool(pool); … … 260 251 261 252 LOG((pool->obj_name, "destroy(): cap=%d, used=%d(%d%%), block0=%p-%p", 262 pool->capacity, pool->used_size, pool->used_size*100/pool->capacity, 253 pool->capacity, pj_pool_get_used_size(pool), 254 pj_pool_get_used_size(pool)*100/pool->capacity, 263 255 ((pj_pool_block*)pool->block_list.next)->buf, 264 256 ((pj_pool_block*)pool->block_list.next)->end));
Note: See TracChangeset
for help on using the changeset viewer.