I am experiencing a frustrating "Out of memory" problem when I call my Fortran dll from a macro in Excel 2007 VBA. Running the dll only needs 500 Mb memory, but there is actually 2.9 Gb memory available. How can it run Out Of Memory?
Descriptions of my question:
I have developed a Fortan dll, which is called from a Excel 2007 macro. When I click a button, the macro will send two input arrays into the dll, then the dll performs calculations (mainly Computational Fluid Dynamics calculations, invoving creating arrays and iterations), and then an output array willl be transfered back into Excel after calling.
In Fortran dll, I created a number of 2 dimensional arrays, in this way:
You can see that I saved all the variables in the main subroutine. But I didn't use any allocatable arrays.
I find that after VBA finished calling the Fortran dll, about 500 Mb memory was not released. It's still there. The memory was not released until Excel is closed.
Everything works well on my computer and other computers with similar hardware conditions, but in my customer's computer, they always have the "Out of memory (Run-time error 7)" problem. This error occured shortlry after it started runing (runing dll normally takes 5 minutes, the error occured at 10 seconds. I think it occured just after initiallization).
In VBA help, the description of Error 7 is:
More memory was required than is available, or a 64K segment boundary was encountered. This error has the following causes and solutions:
You have too many applications, documents, or source files open.
You have a module or procedure that's too large.
You are running Microsoft Windows in standard mode.
You are running Microsoft Windows in enhanced mode, but have run out of virtual memory.
You have terminate-and-stay-resident programs running.
You have many device drivers loaded.
You have run out of space for Public variables.
I don't know which one applies to my case.
Can anyone give me some light on this error? How can it run Out Of Memory since only 500 Mb is need and 2.9 Gb memory is available? Thanks very much! (Sorry about my poor English.)