Relocatable Memory Management Routines
[APR Utility Functions]


Typedefs

typedef struct apr_rmm_t apr_rmm_t
typedef apr_size_t apr_rmm_off_t

Functions

apr_status_t apr_rmm_init (apr_rmm_t **rmm, apr_anylock_t *lock, void *membuf, apr_size_t memsize, apr_pool_t *cont)
apr_status_t apr_rmm_destroy (apr_rmm_t *rmm)
apr_status_t apr_rmm_attach (apr_rmm_t **rmm, apr_anylock_t *lock, void *membuf, apr_pool_t *cont)
apr_status_t apr_rmm_detach (apr_rmm_t *rmm)
apr_rmm_off_t apr_rmm_malloc (apr_rmm_t *rmm, apr_size_t reqsize)
apr_rmm_off_t apr_rmm_realloc (apr_rmm_t *rmm, void *entity, apr_size_t reqsize)
apr_rmm_off_t apr_rmm_calloc (apr_rmm_t *rmm, apr_size_t reqsize)
apr_status_t apr_rmm_free (apr_rmm_t *rmm, apr_rmm_off_t entity)
void * apr_rmm_addr_get (apr_rmm_t *rmm, apr_rmm_off_t entity)
apr_rmm_off_t apr_rmm_offset_get (apr_rmm_t *rmm, void *entity)
apr_size_t apr_rmm_overhead_get (int n)

Typedef Documentation

typedef apr_size_t apr_rmm_off_t

Fundamental allocation unit, within a specific apr_rmm_t

typedef struct apr_rmm_t apr_rmm_t

Structure to access Relocatable, Managed Memory


Function Documentation

void* apr_rmm_addr_get ( apr_rmm_t rmm,
apr_rmm_off_t  entity 
)

Retrieve the physical address of a relocatable allocation of memory

Parameters:
rmm The relocatable memory block
entity The memory allocation to free
Returns:
address The address, aligned with APR_ALIGN_DEFAULT.

apr_status_t apr_rmm_attach ( apr_rmm_t **  rmm,
apr_anylock_t lock,
void *  membuf,
apr_pool_t *  cont 
)

Attach to a relocatable memory block already managed by the apr_rmm API.

Parameters:
rmm The relocatable memory block
lock An apr_anylock_t of the appropriate type of lock
membuf The block of relocatable memory already under management
cont The pool to use for local storage and management

apr_rmm_off_t apr_rmm_calloc ( apr_rmm_t rmm,
apr_size_t  reqsize 
)

Allocate memory from the block of relocatable memory and initialize it to zero.

Parameters:
rmm The relocatable memory block
reqsize How much memory to allocate

apr_status_t apr_rmm_destroy ( apr_rmm_t rmm  ) 

Destroy a managed memory block.

Parameters:
rmm The relocatable memory block to destroy

apr_status_t apr_rmm_detach ( apr_rmm_t rmm  ) 

Detach from the managed block of memory.

Parameters:
rmm The relocatable memory block to detach from

apr_status_t apr_rmm_free ( apr_rmm_t rmm,
apr_rmm_off_t  entity 
)

Free allocation returned by apr_rmm_malloc or apr_rmm_calloc.

Parameters:
rmm The relocatable memory block
entity The memory allocation to free

apr_status_t apr_rmm_init ( apr_rmm_t **  rmm,
apr_anylock_t lock,
void *  membuf,
apr_size_t  memsize,
apr_pool_t *  cont 
)

Initialize a relocatable memory block to be managed by the apr_rmm API.

Parameters:
rmm The relocatable memory block
lock An apr_anylock_t of the appropriate type of lock, or NULL if no locking is required.
membuf The block of relocatable memory to be managed
memsize The size of relocatable memory block to be managed
cont The pool to use for local storage and management
Remarks:
Both
Parameters:
membuf and
memsize must be aligned (for instance using APR_ALIGN_DEFAULT).

apr_rmm_off_t apr_rmm_malloc ( apr_rmm_t rmm,
apr_size_t  reqsize 
)

Allocate memory from the block of relocatable memory.

Parameters:
rmm The relocatable memory block
reqsize How much memory to allocate

apr_rmm_off_t apr_rmm_offset_get ( apr_rmm_t rmm,
void *  entity 
)

Compute the offset of a relocatable allocation of memory

Parameters:
rmm The relocatable memory block
entity The physical address to convert to an offset

apr_size_t apr_rmm_overhead_get ( int  n  ) 

Compute the required overallocation of memory needed to fit n allocs

Parameters:
n The number of alloc/calloc regions desired

apr_rmm_off_t apr_rmm_realloc ( apr_rmm_t rmm,
void *  entity,
apr_size_t  reqsize 
)

Realloc memory from the block of relocatable memory.

Parameters:
rmm The relocatable memory block
entity The memory allocation to realloc
reqsize The new size


Generated on Sat Aug 16 19:14:10 2008 for Apache Portable Runtime Utility Library by  doxygen 1.5.6