LF Fortran 95

-[N]VARHEAP [(size)]

Place local variables on heap

Compile only. Default: -nvarheap

Specify -varheap to cause local variables to be allocated on the heap rather than on the stack.

size is a number > 4096 enclosed in parentheses. It is the minimum variable size in bytes that will be placed on the heap. Variables smaller than size bytes are not placed on the heap.

If size is omitted, it defaults to 4096.

Use the -varheap option when creating programs that have large local arrays. If you notice that increasing the size of a local array causes a stack overflow, using -varheap may alleviate this condition.

Note that the -varheap option does not apply to variables having the SAVE attribute, which includes initialized variables.

Visual Studio Property

The -varheap option is set using the Fortran|Behavior|Allocate Locals on Heap property. This option can be set on the property page for the project only.

Example

LF95 hello.f90 -varheap (2000000)

The above command causes all local variables larger than 2000000 bytes to be allocated on the heap rather than on the stack.

See Also

Setting Build Options