Insufficient Virtual Memory (error 41)

Insufficient Virtual Memory (error 41)

Community Admin's picture

When running a Fortran console application, I get an out of VM error, even though, when watching the program in the task manager, the amount of memory being used is well below the paging file settings. Microsoft Win2K support tells me this has to be a problem with my program, yet the description of the error message (see below), tells me that the o/s isn't set to provide enough memory.

Does this "Insufficient Virtual Memory" error imply a problem with my program or a o/x problem? I've tried all the various run time diagnostics and can't see any fault with my program, which runs fine in all cases where it doesn't generate large amounts of data (e.g., >256M).

Greg Nash (error listing below)

"41 severe (41): Insufficient virtual memory
FOR$IOS_INSVIRMEM. The Compaq Fortran RTL attempted to
exceed its available virtual memory while dynamically
allocating space. To overcome this problem, investigate
increasing the data limit (Control Panel, System,
Performance Tab, Virtual Memory). Before you try to run
this program again, wait until the new system resources
take effect."

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Community Admin's picture

It's quite possible to allocate and deallocate memory in such a way that you don't have a contiguous hole in virtual address space big enough to fit the next allocation request in, even though the actual memory you currently have allocated is negligible.
Even so, it could be a problem with the compiler or RTL although Compaq fixed the worst of their problems in this regard with, IIRC, 6.0B3. You might want to see if vf-support@compaq.com has the tools at hand to diagnose your problem readily; if not, I don't know what to tell you -- you many entities do you have allocated at the point where your program crashes? Is the number small enough that you could print out %LOC() of all of them to see whether virtual memory fragmentation really is a problem?

Community Admin's picture

I have the maximum paging file size set for 2G, but th VM error occurs when memory size (all programs) reaches only 440M, so it seems like there's plenty of available space. The largest alloc block at the time of the error can't be more than 200M, which is what the program is using at the time.

I'm using v6.1A, which isn't supported any more, so am in the process of upgrading to 6.6. Then I'll see what support says.
Greg Nash

Community Admin's picture

Any resolution of your memory problem? I am running into the same thing installing a rather large FORTRAN program on Windows ME system. Likewise I have multiple GB paging space available and even a very small FORTRAN program with an OPEN statement [ OPEN(10,FILE='C:Data.dat',ERR=40,IOSTAT=IA) ] gives me an runtime error = 41.

Community Admin's picture

Greg,

I ran into the same problem you are experiencing, but it had nothing to do with a problem with virtual memory - it was a coding problem that the compiler did not catch. Specifically, it occurred when I tried to open a file and for the life of me I cannot remember what I had done wrong. The point is, you may be barking up the wrong tree when trying to fix the problem. This was exactly what Sam is experiencing with his program.

Tom

Login to leave a comment.