What happens if I run out of virtual memory?

5,308

Solution 1

Depending on the OS, its configuration, and possibly other things, one of the following will happen:

  • The OS will increase the paging file size and move unused processes to it. (Windows will do this; Linux cannot, as it usually uses a fixed-size partition for historical reasons.)
  • The OS will start killing other processes to free up memory. (Linux, or Windows without a pagefile, do this.)
  • The OS will kill the offending process.
  • The memory allocation will simply fail, causing the process to crash sooner or later (not sure if any OS behaves like this).

Simply running out of memory should never cause a BSOD, which is only for unrecoverable situations.

Solution 2

Your virtual memory is limited by the maximum size of your paging file. This defaults to be managed by the operating system and will grow as is needed, so you will probably only run out when your hard disk is full.

You can check to see whether you are using these settings or whether they have been changed via

Right-Click on my My-Computer and select properties.
Advanced system settings.
Advanced
Settings (on performance section)
Advanced
Change (on Virtual Memory section)

When windows gets close to the limit, it will display a warning and recommend that you close some of the programs that are using the most memory.

If you ignore these errors and your system continues to use more memory, then eventually some program will try to allocate memory which will fail. What happens next depends on the program, ie if the program is specifically written to cope with that request being denied, it will fail cleanly, otherwise it may simple crash.

For example, if you try to open another large file in PhotoShop, it may display a message saying that it can't open it because the system does not have enough memory but still allow you to continue to work with the files you are already working on. But if you are totally out of memory, you may not have enough free to display this message and maybe not enough to display the message asking you if want to save your files when you try to close.

So, in my experience, there are just too many things that fail badly when you get to this point, that you are really should heed the warning, but even if you ignore it, you certainly should not expect a BSOD.

Share:
5,308

Related videos on Youtube

Pacerier
Author by

Pacerier

# 9

Updated on September 18, 2022

Comments

  • Pacerier
    Pacerier over 1 year

    Hi all sometimes I run photoshop along with a ton of Chrome tabs and a couple of other programs and my memory looks dangerously near to my 7.99 GB of virtual memory.

    I was wondering what happens when a program allocates more memory then my virtual memory allows? Does it mean that my computer will simply BSOD itself?

    Or can I guarantee that even though the program that requires the additional memory would crash, the OS will be stable (no BSODs) ?

  • Pacerier
    Pacerier over 12 years
    Hmm, when I open a very large image with photoshop (scanned picture, about 12000x50000), everything just hanged and suddenly the computer BSOD itself. What may be the problem?
  • billc.cn
    billc.cn over 12 years
    I think Windows actually behaves like point 4, i.e. memory allocation call can fail but the program doesn't have to be killed immediately. Windows reserved a non-paged pool for kernel use, so normally it won't crash because of low memory. However, some drivers can allocate paged memory and if they're poorly written, can cause an exception in kernel mode which triggers BSoD. However, this can be automatically checked and I bet Microsoft checks for it during driver certification.
  • Pacerier
    Pacerier over 12 years
    But for my situation everything just sort of hanged I can't even Ctrl Alt Del. and then the computer just BSOD itself.. what may be the problem?
  • sgmoore
    sgmoore over 12 years
    It is possible that it could be a hardware issue, so I would run some tests on the memory just to make sure that is ok. But it is more likely to be a buggy device driver. I think you need to try the decode the information on the BSOD which may help determine which driver is causing the BSOD. The BSOD/Stop info should be recorded in your event log if you haven't already got a note of it.
  • user1686
    user1686 over 12 years
    @billc.cn: Driver writers manage to cheat even the WHQL -- and that's assuming they do get their drivers certified, as opposed to just auto-clicking the unsigned driver approval dialog.
  • duct_tape_coder
    duct_tape_coder over 3 years
    I am curious about when the memory pressure continues. If all physical and virtual memory is exhausted and all non-essential applications have been unloaded. I have been encountering issues recently with virtual computers that will go into zombie mode: they do not BSOD but they almost completely lock up, will continue to respond to ping, but do not respond to RDP, VMware console, or vmtools restart guest. They have to be forcibly restarted.