[{"data":1,"prerenderedAt":275},["ShallowReactive",2],{"en-post-4":3},{"id":4,"title":5,"body":6,"description":12,"extension":268,"meta":269,"navigation":270,"path":271,"seo":272,"stem":273,"__hash__":274},"content/post/4.md","4",{"type":7,"value":8,"toc":260},"minimark",[9,13,20,25,28,36,39,43,46,52,58,64,68,71,74,96,99,129,138,142,145,148,151,180,187,191,194,204,210,216,222,228,232,235,241,247,253,256],[10,11,12],"p",{},"Your computer suddenly pops up a \"virtual memory insufficient\" message while you're using it, or the system becomes noticeably sluggish after you open a browser, WeChat, and Word at the same time—many people's first reaction is \"I'm running out of memory, I should add more RAM.\" But you may not know that even if physical memory is not completely full, Windows can still report an error because virtual memory is improperly configured.",[10,14,15,19],{},[16,17,18],"strong",{},"Virtual memory"," is a fundamental technology in which the operating system uses hard disk space to expand available memory, letting programs believe they have more space than actual physical memory. The vast majority of Windows users have never manually adjusted it, and macOS users can't even find a settings entry for it. This article will start with \"what exactly is it,\" then tell you its actual role, how to configure it according to your computer's specs, and how to troubleshoot step by step when you encounter \"virtual memory insufficient.\"",[21,22,24],"h2",{"id":23},"what-is-virtual-memory-first-understand-the-relationship-between-physical-memory-and-it","What Is Virtual Memory? First Understand the Relationship Between Physical Memory and It",[10,26,27],{},"Physical memory is the RAM stick plugged into your motherboard. Data generated while programs are running is stored here first. Its characteristics are extremely fast read/write speeds (DDR5 can reach over 60GB/s), but data disappears after power loss, and capacity is limited.",[10,29,30,31,35],{},"Virtual memory is completely different. It is a dedicated space carved out by the operating system on a hard drive or solid-state drive. In Windows, it corresponds to a hidden file named ",[32,33,34],"code",{},"pagefile.sys",", usually located in the root directory of the system drive. When physical memory is almost full, the system \"moves\" temporarily unused data from memory into this file, freeing up physical memory for currently active programs.",[10,37,38],{},"You can understand it with a metaphor: physical memory is the desktop of your desk, small in space but fastest for taking and putting things. Virtual memory is the filing cabinet next to it, large in capacity but slow to retrieve from. The files you are currently working on are placed on the desktop, while those you are not looking at for the time being are archived in the filing cabinet—when you need them, they are swapped back out.",[21,40,42],{"id":41},"the-role-of-virtual-memory-is-more-than-emergency-rescue-multitasking-stability-and-program-compatibility","The Role of Virtual Memory Is More Than \"Emergency Rescue\": Multitasking, Stability, and Program Compatibility",[10,44,45],{},"Many people think virtual memory is just a \"spare tire when memory is insufficient,\" but its role is far more than that.",[10,47,48,51],{},[16,49,50],{},"Expand available memory and prevent program crashes."," A computer with only 8GB of physical memory can run a large game or design software that requires 12GB of memory, relying on virtual memory continuously swapping cold data out to the hard drive in the background. Without virtual memory, programs would crash directly when physical memory is exhausted.",[10,53,54,57],{},[16,55,56],{},"Ensure the stability of multitasking."," When you open a browser, Photoshop, WeChat, and multiple office documents at the same time, the system needs to schedule all these processes within limited physical memory. Virtual memory acts as a \"buffer,\" allowing inactive window data to be temporarily stored on the hard drive and called back when you switch back, thereby avoiding system freezes caused by instantaneous memory pressure.",[10,59,60,63],{},[16,61,62],{},"Some professional software forcibly depends on virtual memory."," Software such as Photoshop, AutoCAD, and DaVinci Resolve checks whether a paging file exists at startup. If virtual memory is completely disabled, these programs may fail to start or frequently report errors. Even if your physical memory is 32GB or even 64GB, it is not recommended to completely disable the paging file.",[21,65,67],{"id":66},"how-to-set-virtual-memory-recommended-windows-values-and-operation-steps","How to Set Virtual Memory? Recommended Windows Values and Operation Steps",[10,69,70],{},"Windows enables \"Automatically manage paging file size for all drives\" by default, and the system dynamically adjusts according to physical memory and load. For most daily office and internet users, keeping automatic management is enough. But if you often encounter memory warnings, or your physical memory is small (such as 8GB or 16GB), manually setting a reasonable range will be more stable.",[10,72,73],{},"Referring to Microsoft technical documentation and measured data, the recommended values for different memory capacities are as follows:",[75,76,77,84,90],"ul",{},[78,79,80,83],"li",{},[16,81,82],{},"8GB physical memory",": initial 12288MB (12GB), maximum 24576MB (24GB)",[78,85,86,89],{},[16,87,88],{},"16GB physical memory",": initial 16384MB (16GB), maximum 32768MB (32GB)",[78,91,92,95],{},[16,93,94],{},"32GB and above",": keep system automatic management, unless running memory-intensive professional software",[10,97,98],{},"The steps for manual setup are as follows:",[100,101,102,105,108,111,114,120,123,126],"ol",{},[78,103,104],{},"Right-click the \"This PC\" icon and select \"Properties.\"",[78,106,107],{},"Click \"Advanced system settings\" on the left.",[78,109,110],{},"Under the \"Advanced\" tab, click the \"Settings\" button in the \"Performance\" area.",[78,112,113],{},"Switch to the \"Advanced\" tab and click the \"Change\" button in the \"Virtual memory\" area.",[78,115,116,119],{},[16,117,118],{},"Uncheck"," \"Automatically manage paging file size for all drives.\"",[78,121,122],{},"Select a disk with sufficient space (preferably a non-system partition on an SSD), and check \"Custom size.\"",[78,124,125],{},"Enter the corresponding values in \"Initial size\" and \"Maximum size\" (unit: MB), click \"Set,\" then click \"OK.\"",[78,127,128],{},"Restart the computer to make the settings take effect.",[130,131,132],"blockquote",{},[10,133,134,137],{},[16,135,136],{},"Note",": If you reduce the virtual memory size, you must restart the computer; increasing it usually does not require a restart, but to ensure the new configuration is loaded, it is recommended to restart once.",[21,139,141],{"id":140},"macos-virtual-memory-why-cant-you-find-the-setting-option","macOS Virtual Memory: Why Can't You Find the Setting Option?",[10,143,144],{},"If you are using a Mac and cannot find a \"virtual memory\" option no matter how much you search in \"System Settings\"—this is not a problem with the system. macOS uses a fully automatic dynamic paging mechanism. The creation, expansion, and cleanup of all swap files are completed autonomously by the kernel, and users cannot manually specify the size.",[10,146,147],{},"The only thing you can do is check the current swap usage through \"Activity Monitor\": open \"Activity Monitor\" → click the \"Memory\" tab → check the \"Swap Used\" value at the bottom. If this value remains below 300MB for a long time, it means physical memory is completely sufficient and no intervention is needed.",[10,149,150],{},"To check precisely in the terminal, you can run the following in \"Terminal\":",[152,153,158],"pre",{"className":154,"code":155,"language":156,"meta":157,"style":157},"language-bash shiki shiki-themes github-light github-dark","# Check swap space usage (macOS)\nsysctl vm.swapusage\n","bash","",[32,159,160,169],{"__ignoreMap":157},[161,162,165],"span",{"class":163,"line":164},"line",1,[161,166,168],{"class":167},"sJ8bj","# Check swap space usage (macOS)\n",[161,170,172,176],{"class":163,"line":171},2,[161,173,175],{"class":174},"sScJk","sysctl",[161,177,179],{"class":178},"sZZnC"," vm.swapusage\n",[10,181,182,183,186],{},"Only if the ",[32,184,185],{},"used"," value in the output remains high for a long time (for example, exceeding 1GB for a long period) does it indicate that the system is frequently using disk swap. At that point, you should consider upgrading physical memory rather than trying to adjust swap settings.",[21,188,190],{"id":189},"how-to-troubleshoot-insufficient-virtual-memory-from-software-to-hardware-in-order","How to Troubleshoot Insufficient Virtual Memory? From Software to Hardware in Order",[10,192,193],{},"When you see the \"virtual memory insufficient\" warning, do not rush to change the virtual memory size. Troubleshoot in order from simple to complex, and you will often find the root cause faster.",[10,195,196,199,200,203],{},[16,197,198],{},"Step 1: Check which program is eating memory."," Press ",[32,201,202],{},"Ctrl + Shift + Esc"," to open Task Manager, switch to the \"Processes\" tab, and click the \"Memory\" column header to sort in descending order. The process with the highest usage is usually the source of the problem, and you can try closing it first.",[10,205,206,209],{},[16,207,208],{},"Step 2: Check the remaining disk space."," If the disk where virtual memory is located has insufficient remaining space, the paging file cannot expand to the required size. Make sure the system drive retains at least 15–20GB of free space, and use the \"Disk Cleanup\" tool to clean temporary files and update caches.",[10,211,212,215],{},[16,213,214],{},"Step 3: Confirm that virtual memory has not been set too small or disabled."," Enter the virtual memory settings interface according to the previous steps, and check whether \"Automatically manage\" has been turned off and the value set too low. If it has been set to \"No paging file,\" change it back to \"System managed size\" or enter a reasonable value.",[10,217,218,221],{},[16,219,220],{},"Step 4: Check for malware or abnormal processes."," Some mining programs or viruses consume a large amount of memory resources, causing virtual memory to be exhausted quickly. Use Windows Defender or reliable security software to perform a full scan.",[10,223,224,227],{},[16,225,226],{},"Step 5: Consider upgrading physical memory."," If the system still frequently prompts insufficient virtual memory after all the above steps, it means physical memory truly can no longer meet your daily usage needs. Adding a memory stick is the most fundamental solution.",[21,229,231],{"id":230},"precautions-for-adjusting-virtual-memory-and-daily-prevention","Precautions for Adjusting Virtual Memory and Daily Prevention",[10,233,234],{},"Before adjusting virtual memory, there are a few points you must pay attention to.",[10,236,237,240],{},[16,238,239],{},"Do not disable virtual memory."," Even if physical memory is large, completely turning off the paging file may cause system update failures, professional software failing to start, and even blue screens. Some large Windows cumulative updates also require the support of a paging file during installation.",[10,242,243,246],{},[16,244,245],{},"Avoid setting virtual memory too large."," Some people think \"setting it to 5 times the physical memory will make it smoother,\" but in fact an excessively large paging file takes up a lot of disk space, and frequent page swapping actually slows down system response and also affects SSD lifespan.",[10,248,249,252],{},[16,250,251],{},"Prefer placing it on an SSD, but try to avoid the system drive."," If the computer has multiple SSD partitions, placing the paging file on the D drive or E drive can reduce I/O contention on the system drive, but the premise is that the partition has enough remaining space.",[10,254,255],{},"In daily use, regularly cleaning startup items, closing unused background programs, and keeping enough free space on the system drive can fundamentally reduce the occurrence of memory warnings more than repeatedly adjusting virtual memory parameters.",[257,258,259],"style",{},"html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":157,"searchDepth":171,"depth":171,"links":261},[262,263,264,265,266,267],{"id":23,"depth":171,"text":24},{"id":41,"depth":171,"text":42},{"id":66,"depth":171,"text":67},{"id":140,"depth":171,"text":141},{"id":189,"depth":171,"text":190},{"id":230,"depth":171,"text":231},"md",{},true,"/post/4",{"description":12},"post/4","mokuqtmO1KRSlr_NPGouea1aM_Vtz7BdYaPlm18TPnw",1789267714048]