allocator
[utilities]


Classes

struct  axutil_allocator
 Axis2 memory allocator. More...

Defines

#define AXIS2_MALLOC(allocator, size)   ((allocator)->malloc_fn(allocator, size))
#define AXIS2_REALLOC(allocator, ptr, size)   ((allocator)->realloc(allocator, ptr, size))
#define AXIS2_FREE(allocator, ptr)   ((allocator)->free_fn(allocator, ptr))

Typedefs

typedef struct
axutil_allocator 
axutil_allocator_t
 Axis2 memory allocator.

Functions

AXIS2_EXTERN
axutil_allocator_t
axutil_allocator_init (axutil_allocator_t *allocator)
AXIS2_EXTERN void axutil_allocator_free (axutil_allocator_t *allocator)
AXIS2_EXTERN void axutil_allocator_switch_to_global_pool (axutil_allocator_t *allocator)
AXIS2_EXTERN void axutil_allocator_switch_to_local_pool (axutil_allocator_t *allocator)

Typedef Documentation

typedef struct axutil_allocator axutil_allocator_t

Axis2 memory allocator.

Encapsulator for memory allocating routines


Function Documentation

AXIS2_EXTERN void axutil_allocator_free ( axutil_allocator_t allocator  ) 

This function should be used to deallocate memory if the default allocator was provided by the axutil_allocator_init() call.

Parameters:
allocator allocator struct to be freed
Returns:
void

AXIS2_EXTERN axutil_allocator_t* axutil_allocator_init ( axutil_allocator_t allocator  ) 

Initializes (creates) a memory allocator.

Parameters:
allocator user defined allocator. If NULL, a default allocator will be returned.
Returns:
initialized allocator. NULL on error.

AXIS2_EXTERN void axutil_allocator_switch_to_global_pool ( axutil_allocator_t allocator  ) 

Swaps the local_pool and global_pool and makes the global pool the current pool. In case of using pools, local_pool is supposed to hold the pool out of which local values are allocated. In case of values that live beyond a request global pool should be used, hence this method has to be called to switch to global pool for allocation.

Parameters:
allocator allocator whose memory pools are to be switched
Returns:
void

AXIS2_EXTERN void axutil_allocator_switch_to_local_pool ( axutil_allocator_t allocator  ) 

Swaps the local_pool and global_pool and makes the local pool the current pool. In case of using pools, local_pool is supposed to hold the pool out of which local values are allocated. In case of values that live beyond a request global pool should be used. This method can be used to inverse the switching done by axutil_allocator_switch_to_global_pool, to start using the local pool again.

Parameters:
allocator allocator whose memory pools are to be switched
Returns:
void


Generated on Fri Apr 17 11:49:45 2009 for Axis2/C by  doxygen 1.5.3