LibCapy - memoryPool

Memory pool generic class.

Macros:

Generic memory pool class. Declaration macro for a memory pool of a given type. The definition of the type must include CapyMemPoolFields (see below).

Macro to add necessary fields to a structure to make it usable with CapyMemPool

Create a memory pool

Output and side effect(s):

Return an empty memory pool

Allocate a memory pool

Output and side effect(s):

Return an empty memory pool

Flush and destruct a memory pool

Input argument(s):

that: the memory pool to destruct

Flush and free a memory pool

Input argument(s):

that: the memory pool to free

Alloc memory using the memory pool

Output and side effect(s):

Return a 'new' element from the pool. If there was a free one, it is reused, else a new element is allocated and added to the pool before returning it.

Free an element allocated using the pool

Input argument(s):

elem: pointer to the element to free

Output and side effect(s):

The element is marked as free to reuse in the memory pool

Flush a memory pool

Output and side effect(s):

All the elements in the pool are freed (their memory is released using the standard 'free' function)

Definition macro for a memory pool of a given type.

Enumerations:

None.

Typedefs:

None.

Functions:

None.

2022-10-07
in LibCapy,
23 views
Copyright 2021-2023 Baillehache Pascal