Windows 10x64, has 76 Gb free real memory, and have very small (1Gb) virtual memory. Program compiled as x64 application, and at the attempt to allocate 3Gb memory matrix ends with message severe (41): insufficient virtual memory. May be (but it strange) it needs namely VIRTUAL, not real memory? Or, what I can do wrong?
Control Panel | System and Security | System | Advanced system settings | Advanced Tab | Performance [Settings] | Advanced
| Virtual memory
In there you will see the size of the paging file. You likely have too small of a size specified.
** The above assumes you do not have a programming error.
For example, you are using an int type where size_t is required.
Thanks Jim. I increased swapping file from 1 to 30Gb, but witout success. In operator ALLOCATE I still have same error (even after reboot). What's wrong? Smaller allocations are OK...
I agree with Jim that it's probably a coding error on your part. Can you show us a small but complete program that demonstrates the problem?
You are right, I was wrong. Before allocation I calculate needed memory with error. So, I wrongly thought how much memory I allocate. Now all is OK, thanks and sorry. Only one question remains: do I need ro have big swapping file if I have enough real memory? In other words, program need 50 Gb, and I have 70 Gb free real memory, do I need in 50+ Gb swapping file?
Yes - Windows will limit you to the size of the swapfile. 50GB for a swapfile is easy, 70GB RAM? VERY expensive and few systems support so much.
The swap file is a shared resource.
Windows has a long history of NOT managing process virtual memory use of a paging application. It is not unusual for a process that exceeds the physical RAM to bring the system to a crawl (IOW even the Task Manager can take 10-20 minutes to respond). MS could address this issue with better programming and system tuning parameters. e.g. not permitting a process physical RAM occupation exceed nn% thus making the process slow down a bit earlier while keeping the system a bit more alive.
Coincidentally, I just encountered this "insufficient virtual memory" error in a C++ (Qt) program that links a Fortran DLL. After spending some time fruitlessly trying to understand and rectify the paging file size issue (I installed Process Explorer, which can tell you the virtual memory requirements of the running processes - it showed that the 8 Firefox processes were together using about 20 times as much virtual memory as my program), I discovered that the crash was caused by a Fortran coding error. It turned out to have nothing to do with virtual memory. I've made a mental note that next time I see "insufficient virtual memory" I will suspect my code.