Too Much Virtual Memory

Discussion in 'macOS' started by Switz213, May 26, 2008.

  1. Switz213 macrumors 6502

    Joined:
    May 26, 2008
    #1
    My mac is taking up 42.8 Gigs of VM.

    The only windowed programs running are Safari, QuickSilver, and Activity Monitor. No other special processes running either.

    Is this normal?
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    Measured how? If you mean the VM size in Activity Monitor is 42Gb then this does not mean you are using that much virtual memory or anything similar.
     
  3. yellow Moderator emeritus

    yellow

    Joined:
    Oct 21, 2003
    Location:
    Portland, OR
    #3
    To see how much VM is actually being used:

    sudo du -h -d1 /var/vm

    Code:
    yellow$ sudo du -h -d1 /var/vm
    Password:
    1.0G	/var/vm
    
     
  4. Switz213 thread starter macrumors 6502

    Joined:
    May 26, 2008
    #4
    It says VM Size: 42 GB. I assumed that was it.

    Especially since it says I have around 80 MB of space left and I know I have a lot more then that actually.
    I tried that command, but nothing showed up after I entered my pw.
     
  5. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #5
    That's the theoretic maximum if all of the processes (not just windowed ones) running used ALL the RAm they could. It'll never happen.

    You might want to read this Apple article regarding the free memory: you almost certainly have more.
     
  6. yellow Moderator emeritus

    yellow

    Joined:
    Oct 21, 2003
    Location:
    Portland, OR
    #6
    If you're looking at "Free:", then that number is free, unused, unallocated RAM.
    "Inactive:" is allocated RAM that is unused and should be counted as "free" RAM.

    I believe the "VM Size" is the maximum that the OS will try to use as VM, should the need arise, which it's not.

    EDIT: <-- too slow.
     
  7. Switz213 thread starter macrumors 6502

    Joined:
    May 26, 2008
    #7
    Yes, but there is something messed up as the lowest process is update
    its using 500+ MB of VM. Thats the lowest...
     
  8. yellow Moderator emeritus

    yellow

    Joined:
    Oct 21, 2003
    Location:
    Portland, OR
    #8
    Are you sure it's using that?

     
  9. flopticalcube macrumors G4

    flopticalcube

    Joined:
    Sep 7, 2006
    Location:
    In the velcro closure of America's Hat
    #9
    That's the way Leopard reports VM. Its different than Tiger and makes you take a second look. Everything is fine.
     
  10. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #10
    Ignore that column. It's not using 500Mb of memory, real or virtual. That's the max allocation it could use. It's not using it. It almost certainly never will.

    If you really want to know how much virtual memory you are using right now open the Terminal and type "du -ks /var/vm/swapfile*" (without the quotes). That will show you all the swap files that your system has in Kb. Note the may not get removed instantly when not needed.
     
  11. Switz213 thread starter macrumors 6502

    Joined:
    May 26, 2008
    #11
    Then why do I have 90 MB of free HARD DRIVE space. I mean go into finder and look at the bottom of a window. Not on the act. monitor.
     
  12. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #12
    That's not a good idea as that includes the sleepimage which is the size of your machines RAM if it's gone to sleep (using safe sleep). So for me that reports a number 2Gb larger than the amount of virtual memory I've actually used...

    You have far too many files? Seriously: just do what we've told you to find out exactly how much space is being used by swapfiles. It's really easy and will actually tell you what's going on instead of all this pointless speculation.
     
  13. yellow Moderator emeritus

    yellow

    Joined:
    Oct 21, 2003
    Location:
    Portland, OR
    #13
    True. I never, ever, ever put this machine to sleep, therefore, no sleepimage.

    Even though it might be 2GB larger than it needs to be, it would be enough to prove to the OP that his Mac isn't using 42GB of VM. :)
     
  14. flopticalcube macrumors G4

    flopticalcube

    Joined:
    Sep 7, 2006
    Location:
    In the velcro closure of America's Hat
    #14
    Honestly its unrelated. My smallest VM process is also update with over 500MB.
     
  15. Switz213 thread starter macrumors 6502

    Joined:
    May 26, 2008
    #15
    Sorry, I don't mean to be harsh, but my last few posts have come off a bit that way lol.


    I did what you said.
    65536 /var/vm/swapfile0
    65536 /var/vm/swapfile1
    131072 /var/vm/swapfile2
    262144 /var/vm/swapfile3
    262144 /var/vm/swapfile4
    262144 /var/vm/swapfile5
    262144 /var/vm/swapfile6
    262144 /var/vm/swapfile7


    I am 100% sure, that I should have atleast 10 GB of space left.
    It just jumped from 90 MB back to 92 MB, and before it was at 200 MB.
     
  16. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #16
    You seem to be used a little more than 1Gb of swap space so it's not that...

    Edit: or exactly 1.5Gb
     
  17. Switz213 thread starter macrumors 6502

    Joined:
    May 26, 2008
  18. flopticalcube macrumors G4

    flopticalcube

    Joined:
    Sep 7, 2006
    Location:
    In the velcro closure of America's Hat
    #18
    You probably have a runaway log file somewhere.
     
  19. yellow Moderator emeritus

    yellow

    Joined:
    Oct 21, 2003
    Location:
    Portland, OR
    #19
    Use OmniDiskSweeper or something of that ilk to find where your missing disk space has gone.
     
  20. Mitthrawnuruodo Moderator emeritus

    Mitthrawnuruodo

    Joined:
    Mar 10, 2004
    Location:
    Bergen, Norway
    #20
    Try adding another column (not CPU time) in Activity Monitor (e.g. view -> Columns -> Private memory) and see if Activity Monitor doesn't start reporting more reasonable values...

    Discussed from here and onwards.
     
  21. ert3 macrumors 6502a

    ert3

    Joined:
    Dec 10, 2007
    #21
    just out of curiosity are you using an encrypted home directory.
     
  22. tdhurst macrumors 68040

    tdhurst

    Joined:
    Dec 27, 2003
    Location:
    Portland, OR
    #22
    Wtf

    A Mac will use as much memory as is available. If you have less hard drive space, it will use less VM. It's just a precaution if you do start running a lot of programs.

    These type of things are better left worried about by those people who understand them. You don't seem to, so I wouldn't worry much.
     
  23. HLdan macrumors 603

    HLdan

    Joined:
    Aug 22, 2007
    #23
    Yeah, I think you may be getting confused on how the memory is allocated in OS X. You can't possibly have only 90MB of HDD space, your Mac wouldn't run. When you get to around 5GB left the Mac will notify you by an on screen message that it will not be operable until you free up some HDD space.
     
  24. ElectricSheep macrumors 6502

    ElectricSheep

    Joined:
    Feb 18, 2004
    Location:
    Wilmington, DE
    #24
    The size of your hard disk has no bearing whatsoever on the "VM Size" reported through Activity Monitor.

    The VM Size figure is a total of the requested Virtual Address Space by all processes running on the system. However, because of the way Mac OS X handles memory allocation, a reported VM Size of 42.8 GB will not consume 42.8 GB of resources (in memory or on your hard disk). When a request to allocate memory is handled by the kernel, it creates a new virtual object--which you might think of as a small record of the request--but it does not allocate any pages to the request. Pages are the actual slices of memory that consume real space, both inside memory and on the hard disk.

    Basically, the kernel does lazy allocation. It figure that applications, for the most part, request to have much more memory allocated than they will really ever use. The kernel waits until a process starts reading from or writing to these requested addresses before actually allocating pages--and even then it will only allocate enough pages to satisfy that operation.

    As has been stated before, if you want an accurate picture of how much space is really being consumed by virtual memory, you need to look at how many swapfiles have been created in the /var/vm folder.

    Regarding your lack of space problem, I would grab a free copy of WhatSize to find the largest space offenders.
     
  25. operator207 macrumors 6502

    Joined:
    Jul 24, 2007
    #25
    My powerbook 1.67 Tiger didn't give me any onscreen popup when a backup program spun out of control. It did ~5 minutes after I figured out what the problem was, and fixed it though. What I am saying is, it DID give me the error you refer to, but not until I resolved the error, and the OS "sped" back up. If he has not resolved the problem, it may not be able to give him the error. I spend an hour with it doing what it was doing before I resolved the problem. I knew what the problem was, I just had more pressing things to deal with at work.
     

Share This Page