SimGrid: Mallocator constructor and destructor

SimGrid 3.10 Versatile Simulation of Distributed Systems

- Home page
- Online documentation
- Dev's Corner

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Typedefs | Functions
Mallocator constructor and destructor
Mallocators

## 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

  size | size of the internal stack: number of objects the mallocator will be able to store
  new_f | function to allocate a new object of your datatype, called in xbt_mallocator_get() when the mallocator is empty
  free_f | function to free an object of your datatype, called in xbt_mallocator_release() when the stack is full, and when the mallocator is freed.
  reset_f | function 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

  m | the 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()