Changeset 364 for pjproject/trunk
- Timestamp:
- Mar 30, 2006 3:56:01 PM (19 years ago)
- Location:
- pjproject/trunk/pjlib
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/include/pj/config.h
r354 r364 209 209 #endif 210 210 211 /** 212 * Pool debugging. 211 212 /** 213 * If pool debugging is used, then each memory allocation from the pool 214 * will call malloc(), and pool will release all memory chunks when it 215 * is destroyed. This works better when memory verification programs 216 * such as Rational Purify is used. 213 217 * 214 218 * Default: 0 … … 217 221 # define PJ_POOL_DEBUG 0 218 222 #endif 223 224 225 /** 226 * Do we have alternate pool implementation? 227 * 228 * Default: 0 229 */ 230 #ifndef PJ_HAS_POOL_ALT_API 231 # define PJ_HAS_POOL_ALT_API PJ_POOL_DEBUG 232 #endif 233 219 234 220 235 /** … … 261 276 # endif 262 277 #endif 278 279 280 /** 281 * If PJ_IOQUEUE_HAS_SAFE_UNREG macro is defined, then ioqueue will do more 282 * things to ensure thread safety of handle unregistration operation by 283 * employing reference counter to each handle. 284 * 285 * In addition, the ioqueue will preallocate memory for the handles, 286 * according to the maximum number of handles that is specified during 287 * ioqueue creation. 288 * 289 * All applications would normally want this enabled, but you may disable 290 * this if: 291 * - there is no dynamic unregistration to all ioqueues. 292 * - there is no threading, or there is no preemptive multitasking. 293 * 294 * Default: 1 295 */ 296 #ifndef PJ_IOQUEUE_HAS_SAFE_UNREG 297 # define PJ_IOQUEUE_HAS_SAFE_UNREG 1 298 #endif 299 300 301 /** 302 * When safe unregistration (PJ_IOQUEUE_HAS_SAFE_UNREG) is configured in 303 * ioqueue, the PJ_IOQUEUE_KEY_FREE_DELAY macro specifies how long the 304 * ioqueue key is kept in closing state before it can be reused. 305 * 306 * The value is in miliseconds. 307 * 308 * Default: 500 msec. 309 */ 310 #ifndef PJ_IOQUEUE_KEY_FREE_DELAY 311 # define PJ_IOQUEUE_KEY_FREE_DELAY 500 312 #endif 313 263 314 264 315 /** -
pjproject/trunk/pjlib/include/pj/pool.h
r232 r364 17 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 18 */ 19 20 #include <pj/list.h> 21 22 /* See if we use pool's alternate API. 23 * The alternate API is used e.g. to implement pool debugging. 24 */ 25 #if PJ_HAS_POOL_ALT_API 26 # include <pj/pool_alt.h> 27 #endif 28 29 19 30 #ifndef __PJ_POOL_H__ 20 31 #define __PJ_POOL_H__ … … 24 35 * @brief Memory Pool. 25 36 */ 26 27 #include <pj/list.h>28 37 29 38 PJ_BEGIN_DECL … … 475 484 476 485 /** 486 * Dump pool factory state. 487 * @param pf The pool factory. 488 * @param detail Detail state required. 489 */ 490 PJ_INLINE(void) pj_pool_factory_dump( pj_pool_factory *pf, 491 pj_bool_t detail ) 492 { 493 (*pf->dump_status)(pf, detail); 494 } 495 496 /** 477 497 * @} // PJ_POOL_FACTORY 478 498 */ -
pjproject/trunk/pjlib/src/pj/config.c
r315 r364 22 22 23 23 static const char *id = "config.c"; 24 const char *PJ_VERSION = "0.5.4. 1";24 const char *PJ_VERSION = "0.5.4.5"; 25 25 26 26 PJ_DEF(void) pj_dump_config(void) … … 44 44 PJ_LOG(3, (id, " PJ_LOG_USE_STACK_BUFFER : %d", PJ_LOG_USE_STACK_BUFFER)); 45 45 PJ_LOG(3, (id, " PJ_POOL_DEBUG : %d", PJ_POOL_DEBUG)); 46 PJ_LOG(3, (id, " PJ_HAS_POOL_ALT_API : %d", PJ_HAS_POOL_ALT_API)); 46 47 PJ_LOG(3, (id, " PJ_HAS_TCP : %d", PJ_HAS_TCP)); 47 48 PJ_LOG(3, (id, " PJ_MAX_HOSTNAME : %d", PJ_MAX_HOSTNAME)); 48 49 PJ_LOG(3, (id, " ioqueue type : %s", pj_ioqueue_name())); 49 50 PJ_LOG(3, (id, " PJ_IOQUEUE_MAX_HANDLES : %d", PJ_IOQUEUE_MAX_HANDLES)); 51 PJ_LOG(3, (id, " PJ_IOQUEUE_HAS_SAFE_UNREG : %d", PJ_IOQUEUE_HAS_SAFE_UNREG)); 50 52 PJ_LOG(3, (id, " PJ_HAS_THREADS : %d", PJ_HAS_THREADS)); 51 53 PJ_LOG(3, (id, " PJ_LOG_USE_STACK_BUFFER : %d", PJ_LOG_USE_STACK_BUFFER)); -
pjproject/trunk/pjlib/src/pj/pool.c
r315 r364 23 23 #include <pj/os.h> 24 24 25 #if !PJ_HAS_POOL_ALT_API 26 27 25 28 /* Include inline definitions when inlining is disabled. */ 26 29 #if !PJ_FUNCTIONS_ARE_INLINED … … 262 265 263 266 267 #endif /* PJ_HAS_POOL_ALT_API */ 268 -
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 -
pjproject/trunk/pjlib/src/pj/pool_policy_malloc.c
r66 r364 21 21 #include <pj/os.h> 22 22 #include <pj/compat/malloc.h> 23 24 #if !PJ_HAS_POOL_ALT_API 23 25 24 26 /* … … 61 63 0 62 64 }; 65 66 #endif /* PJ_HAS_POOL_ALT_API */
Note: See TracChangeset
for help on using the changeset viewer.