SimGrid  3.9
Versatile Simulation of Distributed Systems
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Mallocator constructor and destructor

Typedefs

typedef struct s_xbt_mallocator * xbt_mallocator_t
 Mallocator data type (opaque structure)

Functions

xbt_mallocator_t xbt_mallocator_new (int size, pvoid_f_void_t new_f, void_f_pvoid_t free_f, void_f_pvoid_t reset_f)
 Constructor.
void xbt_mallocator_free (xbt_mallocator_t mallocator)
 Destructor.

Detailed Description

Function Documentation

xbt_mallocator_t xbt_mallocator_new ( int  size,
pvoid_f_void_t  new_f,
void_f_pvoid_t  free_f,
void_f_pvoid_t  reset_f 
)

Constructor.

Parameters
sizesize of the internal stack: number of objects the mallocator will be able to store
new_ffunction to allocate a new object of your datatype, called in xbt_mallocator_get() when the mallocator is empty
free_ffunction to free an object of your datatype, called in xbt_mallocator_release() when the stack is full, and when the mallocator is freed.
reset_ffunction to reinitialise an object of your datatype, called when you extract an object from the mallocator (can be NULL)

Create and initialize a new mallocator for a given datatype.

Returns
pointer to the created mallocator
See Also
xbt_mallocator_free()
void xbt_mallocator_free ( xbt_mallocator_t  m)

Destructor.

Parameters
mthe mallocator you want to destroy

Destroy the mallocator and all its data. The function free_f is called on each object in the mallocator.

See Also
xbt_mallocator_new()