18.2.214. PMIx_Resource_unit_free

PMIx_Resource_unit_free — Release an array of pmix_resource_unit_t(5) structures allocated by PMIx_Resource_unit_create(3).

18.2.214.1. SYNOPSIS

#include <pmix.h>

void PMIx_Resource_unit_free(pmix_resource_unit_t *d, size_t n);

18.2.214.1.1. Python Syntax

No Python equivalent

18.2.214.2. INPUT PARAMETERS

  • d: Pointer to the array of pmix_resource_unit_t(5) structures to be released.

  • n: Number of structures in the array.

18.2.214.3. DESCRIPTION

Release an array of pmix_resource_unit_t structures that was previously allocated by PMIx_Resource_unit_create(3). Each of the n elements is first destructed as PMIx_Resource_unit_destruct(3) would, and then the array storage itself is freed.

If d is NULL, the function does nothing.

18.2.214.4. RETURN VALUE

PMIx_Resource_unit_free returns no value (void).

18.2.214.5. NOTES

Use PMIx_Resource_unit_free only on storage obtained from PMIx_Resource_unit_create(3). For a single structure provided by the caller (stack or embedded), use PMIx_Resource_unit_destruct(3) instead, as PMIx_Resource_unit_free frees the array storage the library allocated.

The function does not modify the caller’s pointer; after the call the caller should discard or reset d to avoid using freed memory.

18.2.214.6. EXAMPLES

Allocate and free an array:

pmix_resource_unit_t *array;

array = PMIx_Resource_unit_create(2);
/* ... populate and use array ... */
PMIx_Resource_unit_free(array, 2);
array = NULL;