Windows array allocation problem
- From: Roy Lewallen <w7el@xxxxxxxxx>
- Date: Sat, 29 Sep 2007 03:22:26 -0700
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!
Thanks,
Roy Lewallen
.
- Follow-Ups:
- Re: Windows array allocation problem
- From: Louis Krupp
- Re: Windows array allocation problem
- From: Roy Lewallen
- Re: Windows array allocation problem
- From: glen herrmannsfeldt
- Re: Windows array allocation problem
- From: Louis Krupp
- Re: Windows array allocation problem
- From: James Van Buskirk
- Re: Windows array allocation problem
- From: Tim Prince
- Re: Windows array allocation problem
- Prev by Date: Re: Printing of Program Name ??
- Next by Date: Re: How to convert integers to characters?
- Previous by thread: rest energy and dp
- Next by thread: Re: Windows array allocation problem
- Index(es):
Relevant Pages
|