Changeset 364 for pjproject/trunk/pjlib/src/pj/pool_caching.c
- Timestamp:
- Mar 30, 2006 3:56:01 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/pool_caching.c
r338 r364 23 23 #include <pj/os.h> 24 24 25 #if !PJ_HAS_POOL_ALT_API 26 25 27 static pj_pool_t* cpool_create_pool(pj_pool_factory *pf, 26 28 const char *name, … … 164 166 { 165 167 pj_caching_pool *cp = (pj_caching_pool*)pf; 168 unsigned pool_capacity; 166 169 int i; 167 170 … … 175 178 /* Decrement used count. */ 176 179 --cp->used_count; 180 181 pool_capacity = pj_pool_get_capacity(pool); 177 182 178 183 /* Destroy the pool if the size is greater than our size or if the total … … 180 185 * maximum capacity. 181 186 . */ 182 if (pool ->capacity > pool_sizes[PJ_CACHING_POOL_ARRAY_SIZE-1] ||183 cp->capacity + pool ->capacity > cp->max_capacity)187 if (pool_capacity > pool_sizes[PJ_CACHING_POOL_ARRAY_SIZE-1] || 188 cp->capacity + pool_capacity > cp->max_capacity) 184 189 { 185 190 pj_pool_destroy_int(pool); … … 190 195 /* Reset pool. */ 191 196 PJ_LOG(6, (pool->obj_name, "recycle(): cap=%d, used=%d(%d%%)", 192 pool ->capacity, pj_pool_get_used_size(pool),193 pj_pool_get_used_size(pool)*100/pool ->capacity));197 pool_capacity, pj_pool_get_used_size(pool), 198 pj_pool_get_used_size(pool)*100/pool_capacity)); 194 199 pj_pool_reset(pool); 195 200 … … 197 202 * Otherwise put the pool in our recycle list. 198 203 */ 199 for (i=0; i < PJ_CACHING_POOL_ARRAY_SIZE && pool_sizes[i] != pool ->capacity; ++i)204 for (i=0; i < PJ_CACHING_POOL_ARRAY_SIZE && pool_sizes[i] != pool_capacity; ++i) 200 205 ; 201 206 … … 209 214 210 215 pj_list_insert_after(&cp->free_list[i], pool); 211 cp->capacity += pool ->capacity;216 cp->capacity += pool_capacity; 212 217 213 218 pj_mutex_unlock(cp->mutex); … … 229 234 PJ_LOG(3,("cachpool", " Dumping all active pools:")); 230 235 while (pool != (void*)&cp->used_list) { 231 PJ_LOG(3,("cachpool", " %12s: %8d of %8d (%d%%) used", pool->obj_name, 232 pj_pool_get_used_size(pool), pool->capacity, 233 pj_pool_get_used_size(pool)*100/pool->capacity)); 236 unsigned pool_capacity = pj_pool_get_capacity(pool); 237 PJ_LOG(3,("cachpool", " %12s: %8d of %8d (%d%%) used", 238 pj_pool_getobjname(pool), 239 pj_pool_get_used_size(pool), 240 pool_capacity, 241 pj_pool_get_used_size(pool)*100/pool_capacity)); 234 242 total_used += pj_pool_get_used_size(pool); 235 total_capacity += pool ->capacity;243 total_capacity += pool_capacity; 236 244 pool = pool->next; 237 245 } … … 247 255 #endif 248 256 } 257 258 #endif /* PJ_HAS_POOL_ALT_API */ 259
Note: See TracChangeset
for help on using the changeset viewer.