18.2.153. PMIx_App_create
PMIx_App_create — Allocate and initialize an array of
pmix_app_t(5) structures.
18.2.153.1. SYNOPSIS
#include <pmix.h>
pmix_app_t* PMIx_App_create(size_t n);
18.2.153.1.1. Python Syntax
No Python equivalent
18.2.153.2. INPUT PARAMETERS
n: Number of pmix_app_t(5) structures to allocate.
18.2.153.3. DESCRIPTION
Allocate a contiguous array of n pmix_app_t
structures from the heap and initialize (construct) each element so that all
of its fields are zeroed. The returned array is owned by the caller and must be
released with PMIx_App_free(3) (passing the same
count n).
18.2.153.4. RETURN VALUE
Returns a pointer to the newly allocated array of pmix_app_t structures on
success. Returns NULL if n is zero or if the allocation fails.
18.2.153.5. NOTES
PMIx_App_create both allocates and constructs its elements, so it must be
paired with PMIx_App_free(3) (or, for a
single-element allocation, PMIx_App_release(3)),
which destructs the contents and frees the array storage. Do not pass a
created array to PMIx_App_destruct(3) alone, as
that would release the payload without freeing the array itself.
18.2.153.6. EXAMPLES
Create an array of three app structures:
pmix_app_t *apps;
apps = PMIx_App_create(3);
if (NULL == apps) {
/* handle allocation failure */
}
/* ... populate apps[0..2] ... */
PMIx_App_free(apps, 3);