Out of memory problem

Out of memory problem

Dear all, 

I am running a big code for flow simulation and when I am using a mesh with large number of nodes, FORTRAN 90 gave me an error F6773 cannot allocate array out of memory 

So how I can handle this error and if I use intel FORTRAN the problem will be solved or not. 

its about 10000 nodes and I have many arrays in the code , the biggest one dimension is (5*number of nodes ,5*number of nodes) 


10 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Please provide additional technical details.

>>...its about 10000 nodes and I have many arrays in the code , the biggest one dimension is (5*number of nodes,
>>5*number of nodes)...

What platform ( system description / specs ) do you use and what is the total size of these arrays?

I am using Win 7 RAM 16 gigabyte, Fortran 90 under win 32 bit platform, I donnot know the total size of arrays , ut are as follows

ALLOCATE(soln(nnodes),pressV(nnodes),ANST(nnodes,nsteps+1),anse(nnodes,nsteps+1),C_TEMP(NELE,8,8), C_TEMP1(NELE,8,8))
ALLOCATE(MATE(5*NN,5*NN),M3(NNODES,3*NNODES),tempval(5*AC_NODE ),pr(nnodes),Tr(nnodes),xx(nnodes),yy(nnodes),AKTU11(NELE,8,8))
ALLOCATE(F4(3*nnodes),force(3*nnodes +nnodes),ma_vec(2*nnodes +nnodes),mi_vec(3*nnodes +nnodes))
ALLOCATE(displacement_u(3*nnodes,nsteps+1),M8E( NN,NN),LOAD_C(nnodes),AKTU111(NELE,8,8) )
ALLOCATE(pressure_new(nnodes),TEMPERATURE_NEW(nnodes),BOUNDX(NMIN ,3) )

nnodes : is the total number of nodes

Even with allocatable arrays, under Windows 32-bit with Fortran you can't use more than 4GB total for all of the following: Windows OS, your program, your data, .....

As you have so much RAM, it would make more sense to switch to 64-bit Windows and ifort for Intel64.

>>...under Windows 32-bit with Fortran you can't use more than 4GB total for all of the following: Windows OS,
>>your program, your data,...

For the last two items, that is '...program...data...' the limit is 2GB of memory. So, you need to consider a change to a 64-bit configuration.

Also, use the Task Manager in order to evaluate how much memory is allocated by the application when the message 'Out of Memory' is displayed.

Are you still using Microsoft Fortran PowerStation?

2GB is indeed the limit on 32-bit Windows for all program virtual memory combined.

Retired 12/31/2016


The Task Manager does not tell you how much memory is allocated. It tells you how much is in use. Depending on O/S version, memory becomes in-use when the process first touches the allocated memory (page granularity). Thus allocation alone is insufficient. For a memory test program, after (first) allocation you would need to walk the allocated memory using page sized probes (e.g. read or write something every 4KB or 4MB within the allocation). You normally do not do this in an application unless you have a requirement that the allocation us usable. Note, if the page file is too small and not permitted to grow, it is not unusual to receive a "page fault" when writing data to a successfully allocated buffer.

Jim Dempsey

>>...The Task Manager does not tell you how much memory is allocated...


I really don't see a difference in that case between used and allocated. It actually doesn't matter because as soon as 2GB limit is reached Out of Memory message is displayed on a 32-bit platform.

My position is Not to have almost useless theoretical discussions when a simple evaluation needs to be done on the 32-bit platform followed by a test on a 64-bit platform.

Reda A.

My recommendation to you is that you
- rewrite the code so that you have one array allocated per line of code
- import this code into Excel
- text to columns, using (,) as delimiters can help with this.
- compute the size of each array, including the kind/byte size of each variable type.
- use reference to each variable size, so you can test the change to memory usage for changes to problem dimension.
Use of a VLOOKUP for parameters is a good idea, as this allows to sort the allocate lines, based on size.

I would recommend that this would give you a good insight into where all the memory usage is taking place.

A good coding technique is to map out where the arrays are being use, as typically they are not all used at the same time.
There is a long history of sparse memory techniques to reduce memory usage. Creating indexed tables of values is also a useful technique.
Even with 64-bit, mapping techniques to reduce array sizes often result in significant reduction in run times, by mapping out needless computation of zero values.

You certainly have identified a diverse group of variables in your earlier post.


ps : I have attached a spreadsheet of dimensions. It needs correction for parameter values and variable KIND. Once corrected it will show you where the memory is being used. Although you havn't indicated the variable sizes, I would suspect this will identify what to change. I have named "select_data" to help with the sort.


Downloadtext/plain allocate-list.txt3.14 KB
Downloadapplication/vnd.ms-excel allocate-list.xls51.5 KB

Leave a Comment

Please sign in to add a comment. Not a member? Join today