Re: Windows array allocation problem
- From: Louis Krupp <lkrupp@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 30 Sep 2007 13:01:56 -0600
Roy Lewallen wrote:
I'm getting an "insufficient virtual memory" error when trying to allocate an array to a size which is about 385 MB less than the amount of available virtual memory. I'm using the Intel Visual Fortran v. 9.1 compiler, with the compiler and program running under Windows XP.
The allocation statement is
ALLOCATE(A(N), STAT = IStat)
where A is a KIND = 4 complex array. The operation fails, with STAT = 41 (insufficient virtual memory) with N somewhere between 214,358,000 and 214,358,881. These correspond to allocated array sizes of 1,714,864,000 and 1,714,871,048 bytes respectively. (SIZEOF(A) shows the correct size after allocation even when the allocation returns STAT = 41.) The former succeeds, the latter fails. In both cases a call to Windows API function GlobalMemoryStatus or GlobalMemoryStatusEx immediately before the ALLOCATE statement returns a value of available virtual memory of 2,118,221,824 bytes. So I'm getting an "insufficient virtual memory" failure when trying to allocate the array to a size which is 384.665 MB less than the amount of reported available virtual memory. The operation succeeds when the allocated array size is 384.672 MB less than the amount of reported virtual memory, or less.
My questions are:
1. Why can't I allocate an array to a size much closer to the amount of available virtual memory? I realize, of course, that I have to allow for other memory use by the program in deciding the maximum I can safely allocate, but that's not the issue here.
2. If I won't be able to allocate nearly all the available virtual memory, how can I determine in advance how much I *can* safely allocate?
The Intel documentation says in numerous places that virtual memory problems should be addressed by adjusting the virtual memory setting in the Windows Control Panel. I'm a bit confused by this, because I'm under the impression that every 32 bit Windows program has an allocation of 2 GB of virtual memory. Isn't this the pool of memory the array is being allocated within? At any rate, changes to the Control Panel page file setting have no apparent effect on the problem.
Any insight would be greatly appreciated!
What are the consequences if you can't allocate 214,358,881 elements? Does it limit the size of the problem you can solve, or does affect your program's speed or accuracy? If the issue is speed or accuracy, how much of a difference does it make? How much would you lose if you just allocated, say, no more than 1 GB?
Louis
.
- References:
- Windows array allocation problem
- From: Roy Lewallen
- Windows array allocation problem
- Prev by Date: Re: gfortran, g95, and dual-core
- Next by Date: Re: gfortran, g95, and dual-core
- Previous by thread: Re: Windows array allocation problem
- Next by thread: run a program with more than 2**32 bite
- Index(es):
Relevant Pages
|