omp_calloc
– Allocate nullified memory with an allocator ¶Allocate zero-initialized memory with the specified allocator, which can either
be a predefined allocator, an allocator handle or omp_null_allocator
. If
the allocators is omp_null_allocator
, the allocator specified by the
def-allocator-var ICV is used. The to-be allocated memory is for an
array with nmemb elements, each having a size of size bytes. Both
nmemb and size must be nonnegative numbers; if either of them is
zero, omp_calloc
will return a null pointer. If successful, a pointer to
the zero-initialized allocated memory is returned, otherwise the fallback
trait of the allocator determines the behavior.
In target
regions, either the dynamic_allocators
clause must
appear on a requires
directive in the same compilation unit – or the
allocator argument may only be a constant expression with the value of
one of the predefined allocators and may not be omp_null_allocator
.
Memory allocated by omp_calloc
must be freed using omp_free
.
Prototype: | void* omp_calloc(size_t nmemb, size_t size, |
omp_allocator_handle_t allocator) |
Prototype: | void* omp_calloc(size_t nmemb, size_t size, |
omp_allocator_handle_t allocator=omp_null_allocator) |
Interface: | type(c_ptr) function omp_calloc(nmemb, size, allocator) bind(C) |
use, intrinsic :: iso_c_binding, only : c_ptr, c_size_t | |
integer (c_size_t), value :: nmemb, size | |
integer (omp_allocator_handle_kind), value :: allocator |
OMP_ALLOCATOR
– Set the default allocator, Memory allocation, omp_set_default_allocator
– Set the default allocator,
omp_free
– Freeing memory allocated with OpenMP routines, omp_init_allocator
– Create an allocator
OpenMP specification v5.1, Section 3.13.8