Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

turning off virtual memory

How to reduce virtual memory in lion, I have install the maximum amount of memory on my Macbook Pro but losing valuable hd space due to having an extra partition. I want to recover some disk space.

MacBook Pro, Mac OS X (10.7.4)

Posted on May 14, 2012 4:44 PM

Reply
18 replies

Jul 24, 2012 2:53 AM in response to fredfromutica

It seems nobody is interested in your problem, so perhaps no solution for myself. I do have a similar situation with the same hardware as yours. My RAM is showing over 4 GB free, total installed a maximum of 8GB. The virtual memory shows about 300GB, I also would like to reduce this amount to use for my files.

With "top" in the terminal window I also cannot find which process is using such an amount of memory. Mail uses 98MB, Safari is using 97MB, Dreamweaver uses 86MB, the others are all below that, so for what do I need to keep 300GB space available, that seems to me rediculous. If you search through the internet, everybody is only telling, virtual memory handling in MAC OS cannot be touched, there is something seriously wrong, isn'it.

Jul 24, 2012 6:07 AM in response to fredfromutica

Virtual memory is important to the proper operation of your machine. Data is sometimes written off to the drive even if your memory is not full. If your system is down to a level where a few GB is all you have available, you should consider offloading some of your data to an external drive or upgrading your internal storage. Running your system with less than 20GB or so free may cause performance issues. Running your system with very low drive space can result in corruption of data and stability issues.

Jul 24, 2012 7:35 AM in response to fredfromutica

Thanks for all the comments, rebooting did not help, it went down to 260G but because no program was running yet.

I do not want to switch off virtual memory, I just feel the amount is a bit too high.


To check for big files on my system I use daisydisk which gives a nice graphical layout of all the files and helped me to clear some space.


To move certain files to external drives is certainly an option but not convenient. My music and pictures I need on my notebook, the video files I split all over dozens of external hard disks.


I cannot recommend to buy a notebook with 500 GB harddisk, it is just not enough space. I was waiting now for over two years for a new 17inch MBP with more hardisk space and more USB (3) ports, and now I have to read that Apple does not produce such a notebook anymore because of the smaller profit margin compared to the smaller notebooks. What happened to the principle from Steve Jobs, to make a good product and not look for maximum profit.

And what is the fuss with the retina display, my 17inch MBP has a brilliant screen and I do not need a retina display, most of the time I connect a 32 inch FullHD LED TV which renders the retina display useless. I was hoping for more improvement under the hood.


Sorry, I lost the grip here....

Jul 24, 2012 7:59 AM in response to Wolf-gang

Virtual memory size is irrelavent., Actually I think it is broken because no computer with 4GBs of RAM and no programs running would EVER use 250GBs of hard drive space for any memory allocation. It is the Page Outs that you want to keep low. If you have no Page Outs, or small page outs then that is fine.


Check your HDD total space and the space left. I bet you can't fine that supposed 250GBs of space being used. That's because it isn't being used.

Jul 24, 2012 9:15 AM in response to Shootist007

Note that virtual memory is an integral part of any modern OS and cannot be "turned off". Period. But not even Google's busiest servers gobble 250 GB of disk space for swapping, so your disk usage has to come from something else.


Adding more RAM creates a conundrum. On the one hand, we who use the computer and know what apps are going to run also know that 8GB or 16GB of RAM will not require to page out stuff as the RAM space will never be consumed completely. But the OS doesn't know that, so it will set aside a swapping area just in case. And this area will be at least the amount of RAM, if not more. Add the fact that the OS is also built to allow the computer to go to sleep safely, and now it needs a separate sleepimage area also the size of the physical RAM. And suddenly on your old Mac which you just upgraded to, say, 16GB as an extreme case, you find the HDD to be 32GB, 48GB or maybe even more short.

Jul 24, 2012 9:40 AM in response to Shootist007

I think you are right, what "top" is showing in the terminal window is maybe not the actual space used. I did copy a portion of the terminal screen and pasted it below:


Processes: 92 total, 2 running, 1 stuck, 89 sleeping, 423 threads 23:37:08

Load Avg: 0.41, 0.53, 0.64 CPU usage: 2.15% user, 2.15% sys, 95.68% idle

SharedLibs: 16M resident, 7348K data, 0B linkedit.

MemRegions: 14245 total, 670M resident, 52M private, 345M shared.

PhysMem: 1065M wired, 1098M active, 159M inactive, 2323M used, 5867M free.

VM: 230G vsize, 1118M framework vsize, 80370(0) pageins, 0(0) pageouts.

Networks: packets: 148765/23M in, 149862/21M out.

Disks: 181031/3274M read, 22262/395M written.


as you can see, the page outs are zero, the VM size is changing, e few moments ago it was 240G.


Nevertheless, I just ordered a 960 GB SSD harddisk from macsales.com which will solve the problem for a while.

Jul 24, 2012 11:57 AM in response to Shootist007

Again, that is the page space that has been reserved by applications and processes. None of it has been used yet, as indicated by the zero page outs and no swap files being created, but the VM system has reserved page space (and will have set up the registers in RAM for it) of ~185Gb. Almost all apps and many system daemons and processes will automatically request VM page space when they launch, although they may never actually use and virtual memory. But the page space has to be reserved by the VM manager as it is assigned to the requesting app.

Jun 29, 2013 4:28 AM in response to fredfromutica

Are you still having the same problem? (PLEASE READ THE ENTIRE POST BEFORE TRYING THIS OUT)

I've been trying to minimize disk swap activity. Last week, I discovered this page at OSXDaily.com, where virtual memory is shown to be easy to disable in Mac OS X. To disable it, the solution is quite simple. In Terminal, type this line and restart:


sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist



To re-enable it, just repeat above command with the 'load' option.

Turning swap off entirely will slow down your machine when doing processor-intensive tasks.

No swap files in Private/var/vm, 0% cache hits and about 800-900 MB RAM still free (3 GB used) during peak usage.


WARNING: I haven't tested this one, and I think it may have an impact during memory-intensive tasks, not necessarily processor-intensive tasks as written above. Swap is an integral part of OS X, andI do not recommend disabling the virtual memory subsystem on any version of Mac OS X. For instance, if you use up all available physical RAM, what happens when there's no swap available? Perhaps someone can chime in in the comments, but I believe your machine could lock up. However, if you have sufficient physical RAM and want to eke out that last little bit of extra speed, you can try this at your own risk.] Don't do it unless you know exactly what you are doing.

References: Original BugTraq posts (1, 2) describing the security problems and how to exploit them.

Info on moving swap and how swap works


Disclaimer: I have no connections to Apple, Jetico or Freshly Squeezed Software. Turning your swap off may cause problems when trying to do functions that require large amounts of memory, resulting in your system freezing.

Jun 29, 2013 7:12 AM in response to Mohammedsawaie

Keep in mind this is a highly UNrecommended thing to do.


If you have lots of RAM, such that your system is not actually paging out to virtual swap files anyway, then doing the above is rather pointless. Again, regardless of how much VM page space has been reserved by the system, if your are, in fact, NOT using any swap files space (yet), or if you have lots of RAM, you may never use any actual disk space for swap. In those cases, disabling the swap files is essentially a complete waste of time, as there are none actually in use on your system anyway.


If you have somewhat or much less RAM then your system needs given the tasks you are running, and you normally or occasionally do actually incur page-outs to swap file(s), then disabling the swap files can cause your system to lock up or crash, and you risk loosing any work in progress in open files, as well as corrupting cache and settings.


Again I will mention, that the size of VM listed in Activity Monitor is NOT swap memory actually in use. At boot, OS X has to establish page registries in RAM (which are very small) based on the requested VM space of the OS itself and its various associated tasks and daemons. All that VM represents is address registries to hold the pointers to actual page-outs, if or when page-outs actually do occur.

turning off virtual memory

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.