fredfromutica

Q: 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

Close

Q: turning off virtual memory

  • All replies
  • Helpful answers

Page 1 Next
  • by Wolf-gang,

    Wolf-gang Wolf-gang Jul 24, 2012 2:53 AM in response to fredfromutica
    Level 1 (0 points)
    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.

  • by clintonfrombirmingham,

    clintonfrombirmingham clintonfrombirmingham Jul 24, 2012 3:28 AM in response to Wolf-gang
    Level 7 (30,009 points)
    Mac OS X
    Jul 24, 2012 3:28 AM in response to Wolf-gang

    Virtual memory is always on. If you want to read some technical data about OS X virtual memory usage, see here.

     

    Clinton

  • by Shootist007,

    Shootist007 Shootist007 Jul 24, 2012 3:51 AM in response to Wolf-gang
    Level 6 (16,660 points)
    Jul 24, 2012 3:51 AM in response to Wolf-gang

    Reboot your system. V Mem will drop to nothing.

  • by JoeyR,

    JoeyR JoeyR Jul 24, 2012 6:07 AM in response to fredfromutica
    Level 6 (8,280 points)
    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.

  • by Wolf-gang,

    Wolf-gang Wolf-gang Jul 24, 2012 7:35 AM in response to fredfromutica
    Level 1 (0 points)
    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....

  • by Shootist007,

    Shootist007 Shootist007 Jul 24, 2012 7:59 AM in response to Wolf-gang
    Level 6 (16,660 points)
    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.

  • by Courcoul,

    Courcoul Jul 24, 2012 9:15 AM in response to Shootist007
    Level 6 (14,193 points)
    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.

  • by Wolf-gang,

    Wolf-gang Wolf-gang Jul 24, 2012 9:40 AM in response to Shootist007
    Level 1 (0 points)
    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.

  • by Michael Black,

    Michael Black Michael Black Jul 24, 2012 9:46 AM in response to Wolf-gang
    Level 7 (24,146 points)
    Jul 24, 2012 9:46 AM in response to Wolf-gang

    VM is showing you the amount of memory page space that has been reserved or assigned at the request of various programs and processes (vsize), not what is actually in use.

     

    see http://support.apple.com/kb/HT4437

  • by Wolf-gang,

    Wolf-gang Wolf-gang Jul 24, 2012 10:14 AM in response to Michael Black
    Level 1 (0 points)
    Jul 24, 2012 10:14 AM in response to Michael Black

    Ok, I got it, thanks. Anyhow your link points to using airplay, nothing about virtual memory.

  • by Michael Black,

    Michael Black Michael Black Jul 24, 2012 10:17 AM in response to Wolf-gang
    Level 7 (24,146 points)
    Jul 24, 2012 10:17 AM in response to Wolf-gang

    Sorry, though I had hit "copy" before I pasted that, but I guess not

     

    http://support.apple.com/kb/TA20517

  • by Shootist007,

    Shootist007 Shootist007 Jul 24, 2012 11:49 AM in response to Courcoul
    Level 6 (16,660 points)
    Jul 24, 2012 11:49 AM in response to Courcoul

    I'm pretty sure this is what the OP is talking about.

     

    Screen Shot 2012-07-24 at 2.39.58 PM.png

    As you see mine is 185.62GB which simply can't be right. There is nothing running on my Mac, right now, I have 5+ GBs of RAM left and no page outs and zero swap.

  • by Michael Black,

    Michael Black Michael Black Jul 24, 2012 11:57 AM in response to Shootist007
    Level 7 (24,146 points)
    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.

  • by Mohammedsawaie,

    Mohammedsawaie Mohammedsawaie Jun 29, 2013 4:28 AM in response to fredfromutica
    Level 1 (0 points)
    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, and I 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.

Page 1 Next