Ignore:
Timestamp:
Jul 9, 2006 10:05:46 AM (17 years ago)
Author:
bennylp
Message:

Added feature to report peak memory used in caching pool

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/include/pj/pool.h

    r588 r594  
    450450     */ 
    451451    void (*dump_status)( pj_pool_factory *factory, pj_bool_t detail ); 
     452 
     453    /** 
     454     * This is optional callback to be called by allocation policy when 
     455     * it allocates a new memory block. The factory may use this callback 
     456     * for example to keep track of the total number of memory blocks 
     457     * currently allocated by applications. 
     458     * 
     459     * @param factory       The pool factory. 
     460     * @param size          Size requested by application. 
     461     * 
     462     * @return              MUST return PJ_TRUE, otherwise the block 
     463     *                      allocation is cancelled. 
     464     */ 
     465    pj_bool_t (*on_block_alloc)(pj_pool_factory *factory, pj_size_t size); 
     466 
     467    /** 
     468     * This is optional callback to be called by allocation policy when 
     469     * it frees memory block. The factory may use this callback 
     470     * for example to keep track of the total number of memory blocks 
     471     * currently allocated by applications. 
     472     * 
     473     * @param factory       The pool factory. 
     474     * @param size          Size freed. 
     475     */ 
     476    void (*on_block_free)(pj_pool_factory *factory, pj_size_t size); 
     477 
    452478}; 
    453479 
     
    558584 
    559585    /** 
     586     * Total size of memory currently used by application. 
     587     */ 
     588    pj_size_t       used_size; 
     589 
     590    /** 
     591     * The maximum size of memory used by application throughout the life 
     592     * of the caching pool. 
     593     */ 
     594    pj_size_t       peak_used_size; 
     595 
     596    /** 
    560597     * Lists of pools in the cache, indexed by pool size. 
    561598     */ 
Note: See TracChangeset for help on using the changeset viewer.