Best Reviews logo
Best Reviews may receive compensation for its content through paid collaborations. See how we sustain our work & review products.
Should You Disable Virtual Memory or Not?

Should You Disable Virtual Memory or Not?

By István F.István F. Verified by Adam B.Adam B. Last updated: July 18, 2024 (0)

An essential part of the built-in memory management system is virtual memory, which allows the system to outgrow the limitations of physical RAM. Since physical memory (alongside the CPU) is in high demand and short supply, the applications you install on a Mac will fight for every single bit available.

While it comes at a certain cost, virtual memory helps the system to escape from the limitations imposed at the moment of purchase – specifically how much RAM your budget allows – and plays a key role in providing a good user experience regardless of memory restrictions.

How virtual memory works

When an application asks for memory space for its processes and data, and there is no free space available, the system checks if there is any occupied but without recent activity. If there is, the system creates a ‘backing store’ on the startup drive, a file that it writes these processes and data to. This process is called page-out or swap-out and the backing store is called the swap file.

Since the swap file (or files, depending on the amount of memory used) is a component of the virtual memory, it contains the virtual address of the processes paged out from the RAM. This file is saved to the startup disk in the dedicated virtual memory directory.

Depending how many apps are running and the pressure they are putting on the memory, you’ll see at least two equally sized chunks of file. In macOS High Sierra, swap files are 1GB in size, but that can vary on older macOS or OS X versions.

Along with the swap files (numbered from 0) in the virtual memory directory, there is also another file called ‘sleepimage’. As the name suggests, this file contains the data located in the Mac’s RAM when it is written to disk just before the computer enters into hibernation mode. Sleepimage relates to memory management since it is preserving existing data in the physical memory, hence its place in the virtual memory directory. When the computer wakes from hibernation mode, the data paged out to the sleepimage file is then paged back into the RAM, so users can continue their work from where they left off.

Pros and cons of virtual memory

Virtual memory is useful for the following reasons:

  • It lets the system escape from the limitations of physical memory.
  • It only exists when it is needed: the system will request virtual memory only when an application demands memory space that is not available. Still, if you have virtual memory enabled, you’ll likely see some activity there even if your system has free memory.
  • The system creates a backing store on the startup drive to give space to other apps in need of memory space.

Enabling virtual memory, however, brings disadvantages as well:

  • Since the swap files are located on the Mac’s startup disk, app responsiveness will depend on the speed of the hard drive (ultra-slow) or SSD (slow).
  • As memory pressure grows, virtual memory will automatically increase its space demand on the startup disk. If one or multiple apps generate memory leaks, you might end up with a “startup disk full” error message.

How to check virtual memory usage

Disabling virtual memory is not recommended for systems with low amounts of RAM (4GB and lower), because it will heavily impact overall system stability and the user experience. On Macs with 8GB of RAM or more, virtual memory can be disabled, but we recommend checking its status before doing so. Proceed with disabling virtual memory only if you notice an unusually high amount of swapping.

Fortunately, there is a great command that will show you exactly how the system is handling virtual memory.

To check how macOS uses virtual memory, open Terminal and type in this command, followed by enter:

vm_stat

Terminal then will display the current status of memory usage. If an interval is specified, vm_stat will update the statistics each time this interval is met. As you can see from the example below, vm_stat will display the total number of free, active, inactive, and wired pages, along with the total number of swap-ins and swap-outs.

You can also get some virtual memory usage statistics using the ‘top’ command. To get that data, simply open Terminal and type “top” followed by enter, and you’ll see an updated live list of memory usage alongside other relevant information.


Best mac optimization software of 2024

Editor's choice
CleanMyMac X logo
Editor's rating:
(4.5)
User-friendly dashboard
Effective scanning and cleaning options
Various maintenance tools
Built-in malware remover
All-around protection
MacKeeper logo
Editor's rating:
(4)
Personalized remote assistance
Unique optimization tools
Anti-theft tracking
Built-in antivirus
Beginners
MacBooster logo
Editor's rating:
(3.5)
Fast scanning
User-friendly UI
Virus and malware scan
Great cleaning features
Businesses
CCleaner for Mac logo
Editor's rating:
(4)
Fast scans and cleaning
Full customization
Extensive free version
Affordable
User Feedback

 Leave a reply

Your email address will not be published. Required fields are marked *


Best Reviews

Best Reviews may receive compensation for its content through paid collaborations and/or affiliate links. Learn more about how we sustain our work and review products.

©2012-2024 Best Reviews, a clovio brand – All rights reserved
Privacy policy · Cookie policy · Terms of use · Partnerships · Contact us