# ALLOCATE Clause

Directive Clause: Specifies the memory allocator to be used for one or more private variables or common blocks of a construct. This feature is only available for ifx.

## Syntax

ALLOCATE ([allocator :] list)

-or-

ALLOCATE (allocator-modifier [, allocator-modifier] : list)

allocator | Is an integer expression with a kind type of omp_allocator_handle_kind.
list | Is a comma-separated list of variables or named common blocks that have been specified in a data sharing clause on the same directive that makes the variable or common block private for the construct. A common block name must be enclosed in slashes (/ /).
allocate-modifier | Is one of the following: ALLOCATOR (allocator) allocator is an integer expression with a kind type of `omp_allocator_handle_kind`. If allocator is not specified, the list items in the clause will be allocated using the allocator specified by the `def-allocator-var` internal control variable (ICV). At most one ALLOCATOR allocate-modifier is permitted in the ALLOCATE clause. ALIGN (alignment) alignment is a positive integer scalar expression with a value that is a positive power of two. Each list item is allocated with a byte alignment of at least the maximum of the following: The required alignment specified by Fortran The alignment trait of the specified allocator The alignment value specified by the ALIGN allocate-modifier If alignment is not specified, each list item is allocated with a byte alignment of at least the maximum of the following: The required alignment specified by Fortran The alignment trait of the specified allocator At most one ALIGN allocate-modifier is permitted in the ALLOCATE clause.

Each list item must appear in a data sharing clause that creates a private copy of the list item in the directive containing the ALLOCATE clause. The storage for the private copies of an object specified in the list are allocated using the specified memory allocator.

An ALLOCATE clause in a TARGET directive or a directive within a TARGET region must specify an allocator expression unless a REQUIRES directive with the DYNAMIC_ALLOCATORS clause appears in the same compilation unit.

The result of allocating private variables with a memory allocator whose access trait is set to THREAD by a TASK, TASKLOOP, or TARGET directive is undefined.

Parent topic: A to B

## See Also

ALLOCATE Directive
OpenMP* Memory Spaces and Allocators