Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28657 Discussions

How can one fix the run-time error 41 "No sufficient virtual memory"?

Nan_Deng
Beginner
331 Views
When running a program I encountered the run-time error message 41: No sufficient virtual memory.

I am running for visual fortran v.11.1.054, winXP64 SP1. The machine is HP xw8400, Xeon5160 quad processors, 8GB RAM.

I have changed thethe virtual memory setting in the "properties - advanced" optionsfrom default max of 4GB to 128GB for allowed paging but the same problem happened at the same time (after running 3 1/2 hrs).

Any hints on how to solve this problem will be greatly appreciated.
0 Kudos
3 Replies
Martyn_C_Intel
Employee
331 Views
Sounds like you have a memory leak? You might start by monitoring your program's memory use using Task Manager, and watch how it grows.
0 Kudos
Nan_Deng
Beginner
331 Views
Thanks for your suggestion and I'll start to monitor the memory. If there is a memory spike, will increase the maximum allowable pagingin "my computer - properties - advanced -virtual memory" solve the problem? (Is that the right place for virtual memory control?) Is there any inherent limit for the compiler? Or are theresome other buttons I can push to solve this problem?
0 Kudos
Martyn_C_Intel
Employee
331 Views
If your application genuinely needs a lot of memory, increasing the "virtual memory" setting may help. There's usually also an option to let the system manage the size of the pagingfile, so that it is increased automatically when necessary. But if you are making significant use of all this virtual memory, your application may become very slow, as it spends a lot of time paging in and out.

On the other hand, if you have a memory leak, (running for >3 hours before running out of memory is suggestive of this), memory use may just go on and on gradually increasing, and no amount of additional virtual memory may be enough. Programs without leaks usually allocate most of the needed memory near the start, and subsequent changes may cause the memory usage to go down as well as up.

On a 64 bit system, there is essentially no limit coming from the compiler itself, provided that you allocate memory dynamically (E.g. using ALLOCATE statements, and not static declarations).
You should check that memory that is ALLOCATEd subsequently gets DEALLOCATEd, either explicitly or implicitly. Also, try to use allocatable arrays in preference to pointers, if you don't need the pointer functionality. The compiler and library won't let you allocate an allocatable array multiple times, whereas I suspect it would allow you to keep allocating new memory to a pointer.
0 Kudos
Reply