How to increase heap memory

I use PGF Visual Fortran version 15.10, 32-bit, on Windows 8

When I use allocate statement for too many arrays, the allocate statement may fail (return non-zero STAT).

1/ Is there any way to increase heap memory so that allocate would not fail? is there anything like -Mlarge_arrays for 32 bit compiler?

2/ If I reduce stack memory (reserve and commit), does it help increase heap memory usage?

3/ If I move to 64 bit compiler, does it reduce the likelihood of failure of allocate statements?

Thanks

Giang Nong

Hi Giang Nong,

When I use allocate statement for too many arrays, the allocate statement may fail (return non-zero STAT).

Can you please clarify what you mean by “too many”? How many arrays is that? What is the total amount of memory used when the failure happens? Are any of the arrays greater than 2GB in size?

1/ Is there any way to increase heap memory so that allocate would not fail? is there anything like -Mlarge_arrays for 32 bit compiler?

Not for 32-bit Windows.

2/ If I reduce stack memory (reserve and commit), does it help increase heap memory usage?

No, only the stack.

3/ If I move to 64 bit compiler, does it reduce the likelihood of failure of allocate statements?

It likely will help but without an example of the failing code or possibly more details of the failure, I can’t be sure.

-Mat

I don’t know how to get the total amount of memory used when the failure happens. I was allocating about 16000 arrays, each array has size of 20,000 bytes. There are, of course, other allocated arrays in the program. That is why I can’t tell the total amount of used memory.

Hmm, that doesn’t seem too big at ~0.3GB. Granted the other arrays might be pushing you over the 2GB limit.

What’s the error code being returned by istat?

-Mat

Istat=1

The arrays are declared Real8 when allocate fails. I changed to Real4 and allocate is successful

Ok, so it does seem likely that you’re hitting the 2GB memory limit for a 32-bit OS. Not much can be done except to move to a 64-bit OS.

-Mat