Apache Portable Runtime Utility Library
Typedefs | Functions
Relocatable Memory Management Routines

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)
 

Detailed Description

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
rmmThe relocatable memory block
entityThe 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
rmmThe relocatable memory block
lockAn apr_anylock_t of the appropriate type of lock
membufThe block of relocatable memory already under management
contThe 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
rmmThe relocatable memory block
reqsizeHow much memory to allocate
apr_status_t apr_rmm_destroy ( apr_rmm_t rmm)

Destroy a managed memory block.

Parameters
rmmThe relocatable memory block to destroy
apr_status_t apr_rmm_detach ( apr_rmm_t rmm)

Detach from the managed block of memory.

Parameters
rmmThe 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
rmmThe relocatable memory block
entityThe 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
rmmThe relocatable memory block
lockAn apr_anylock_t of the appropriate type of lock, or NULL if no locking is required.
membufThe block of relocatable memory to be managed
memsizeThe size of relocatable memory block to be managed
contThe pool to use for local storage and management
Remarks
Both
Parameters
membufand
memsizemust 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
rmmThe relocatable memory block
reqsizeHow 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
rmmThe relocatable memory block
entityThe 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
nThe 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
rmmThe relocatable memory block
entityThe memory allocation to realloc
reqsizeThe new size