WARNING: The online documentation has moved to https://docs.pjsip.org.

Visit the new documentation at https://docs.pjsip.org:

BLOG | DOCUMENTATION | GITHUB

Home --> Documentations --> PJLIB Reference

pj_pool_factory Struct Reference
[Pool Factory and Policy]

Data Fields

pj_pool_factory_policy policy
pj_pool_t *(* create_pool )(pj_pool_factory *factory, const char *name, pj_size_t initial_size, pj_size_t increment_size, pj_pool_callback *callback)
void(* release_pool )(pj_pool_factory *factory, pj_pool_t *pool)
void(* dump_status )(pj_pool_factory *factory, pj_bool_t detail)
pj_bool_t(* on_block_alloc )(pj_pool_factory *factory, pj_size_t size)
void(* on_block_free )(pj_pool_factory *factory, pj_size_t size)
int dummy

Detailed Description

This structure contains the declaration for pool factory interface.

Forward declaration for memory pool factory.


Field Documentation

pj_pool_t*(* pj_pool_factory::create_pool)(pj_pool_factory *factory, const char *name, pj_size_t initial_size, pj_size_t increment_size, pj_pool_callback *callback)

Create a new pool from the pool factory.

Parameters:
factory The pool factory.
name the name to be assigned to the pool. The name should not be longer than PJ_MAX_OBJ_NAME (32 chars), or otherwise it will be truncated.
initial_size the size of initial memory blocks taken by the pool. Note that the pool will take 68+20 bytes for administrative area from this block.
increment_size the size of each additional blocks to be allocated when the pool is running out of memory. If user requests memory which is larger than this size, then an error occurs. Note that each time a pool allocates additional block, it needs 20 bytes (equal to sizeof(pj_pool_block)) to store some administrative info.
callback Cllback to be called when error occurs in the pool. Note that when an error occurs during pool creation, the callback itself is not called. Instead, NULL will be returned.
Returns:
the memory pool, or NULL.

Dump pool status to log.

Parameters:
factory The pool factory.

This is optional callback to be called by allocation policy when it allocates a new memory block. The factory may use this callback for example to keep track of the total number of memory blocks currently allocated by applications.

Parameters:
factory The pool factory.
size Size requested by application.
Returns:
MUST return PJ_TRUE, otherwise the block allocation is cancelled.

This is optional callback to be called by allocation policy when it frees memory block. The factory may use this callback for example to keep track of the total number of memory blocks currently allocated by applications.

Parameters:
factory The pool factory.
size Size freed.

Release the pool to the pool factory.

Parameters:
factory The pool factory.
pool The pool to be released.

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.