HOME
| OPENMP API Specification: Version 5.0 November 2018

3.7.6  omp_alloc

SummaryThe omp_alloc routine requests a memory allocation from a memory allocator.

Format

SVG-Viewer needed.

 

 
void *omp_alloc (size_t size, omp_allocator_handle_t allocator);  

SVG-Viewer needed.

SVG-Viewer needed.

 

 
void *omp_alloc( 
  size_t size, 
  omp_allocator_handle_t allocator=omp_null_allocator 
);  

SVG-Viewer needed.

Constraints on ArgumentsUnless dynamic_allocators appears on a requires directive in the same compilation unit, omp_alloc invocations that appear in target regions must not pass omp_null_allocator as the allocator argument, which must be a constant expression that evaluates to one of the predefined memory allocator values.

EffectThe omp_alloc routine requests a memory allocation of size bytes from the specified memory allocator. If the allocator argument is omp_null_allocator the memory allocator used by the routine will be the one specified by the def-allocator-var ICV of the binding implicit task. Upon success it returns a pointer to the allocated memory. Otherwise, the behavior specified by the fallback trait will be followed. Allocated memory will be byte aligned to at least the alignment required by malloc.

Cross References