table of contents
| PMIX_DATA_ARRAY_CREATE(3) | OpenPMIx | PMIX_DATA_ARRAY_CREATE(3) |
PMIx_Data_array_create — Allocate and initialize a pmix_data_array_t(5) <#man5-pmix-data-array-t> together with its element storage.
SYNOPSIS¶
#include <pmix.h> pmix_data_array_t* PMIx_Data_array_create(size_t n, pmix_data_type_t type);
Python Syntax¶
No Python equivalent
INPUT PARAMETERS¶
- n: Number of elements the array is to hold.
- type: The pmix_data_type_t(5) <#man5-pmix-data-type-t> of the elements.
DESCRIPTION¶
Allocate a single pmix_data_array_t <#man5-pmix-data-array-t> structure from the heap and construct it (via PMIx_Data_array_construct(3) <#man3-pmix-data-array-construct>) so that its backing element array holds n elements of the given type. Both the structure and its element storage are owned by the caller.
RETURN VALUE¶
Returns a pointer to the newly allocated and initialized pmix_data_array_t on success. Returns NULL if n is zero or if the allocation of the structure fails.
NOTES¶
PMIx_Data_array_create both allocates and constructs, so it must be paired with PMIx_Data_array_free(3) <#man3-pmix-data-array-free>, which destructs the elements and frees the structure. Do not pass a created array to PMIx_Data_array_destruct(3) <#man3-pmix-data-array-destruct> alone, as that releases the element storage without freeing the pmix_data_array_t structure itself.
EXAMPLES¶
Create a data array of eight pmix_proc_t(5) <#man5-pmix-proc-t> elements:
pmix_data_array_t *darray;
darray = PMIx_Data_array_create(8, PMIX_PROC);
if (NULL == darray) {
/* handle allocation failure */
}
/* ... populate darray->array ... */
PMIx_Data_array_free(darray);
See also:
Copyright¶
2014-2026, OpenPMIx Community
| November 5, 2026 |