BLOG | DOCUMENTATION | GITHUB

Home --> Documentations --> PJLIB Reference

pj_caching_pool Struct Reference

#include <pool.h>

Data Fields

pj_pool_factory factory
 
pj_size_t capacity
 
pj_size_t max_capacity
 
pj_size_t used_count
 
pj_size_t used_size
 
pj_size_t peak_used_size
 
pj_list free_list [16]
 
pj_list used_list
 
char pool_buf [256 *(sizeof(size_t)/4)]
 
pj_lock_tlock
 
unsigned used_count
 
unsigned used_size
 
unsigned peak_used_size
 

Detailed Description

Declaration for caching pool. Application doesn't normally need to care about the contents of this struct, it is only provided here because application need to define an instance of this struct (we can not allocate the struct from a pool since there is no pool factory yet!).

Forward declaration for caching pool, a pool factory implementation.

Field Documentation

◆ capacity

pj_size_t pj_caching_pool::capacity

Current factory's capacity, i.e. number of bytes that are allocated and available for application in this factory. The factory's capacity represents the size of all pools kept by this factory in it's free list, which will be returned to application when it requests to create a new pool.

◆ factory

pj_pool_factory pj_caching_pool::factory

Pool factory interface, must be declared first.

◆ free_list

pj_list pj_caching_pool::free_list[16]

Lists of pools in the cache, indexed by pool size.

◆ lock

pj_lock_t* pj_caching_pool::lock

Mutex.

◆ max_capacity

pj_size_t pj_caching_pool::max_capacity

Maximum size that can be held by this factory. Once the capacity has exceeded max_capacity, further pj_pool_release() will flush the pool. If the capacity is still below the max_capacity, pj_pool_release() will save the pool to the factory's free list.

◆ peak_used_size

pj_size_t pj_caching_pool::peak_used_size

The maximum size of memory used by application throughout the life of the caching pool.

◆ pool_buf

char pj_caching_pool::pool_buf[256 *(sizeof(size_t)/4)]

Internal pool.

◆ used_count

pj_size_t pj_caching_pool::used_count

Number of pools currently held by applications. This number gets incremented everytime pj_pool_create() is called, and gets decremented when pj_pool_release() is called.

◆ used_list

pj_list pj_caching_pool::used_list

List of pools currently allocated by applications.

◆ used_size

pj_size_t pj_caching_pool::used_size

Total size of memory currently used by application.


The documentation for this struct was generated from the following files:

 


PJLIB Open Source, high performance, small footprint, and very very portable framework
Copyright (C) 2006-2009 Teluu Inc.