Help with Virtual memory and swapping

Discussion in 'macOS' started by Travisimo, May 5, 2011.

  1. Travisimo macrumors 6502a

    Joined:
    Dec 22, 2009
    #1
    I have an iMac running Snow Leopard with 8GB of physical RAM. When I first boot my computer, it runs super smooth with no problems to speak of. However, I leave my computer on all the time, and after a while, the system runs very sluggish. I have iStat Menus running and it shows my RAM usage.

    Over time, my system will show very little free RAM and a LOT of "inactive" memory. For example, right now it shows the following:

    Wired = 543 MB
    Active = 3.61 GB
    Inactive = 3.77 GB
    Free = 145 MB

    And so, my system is constantly swapping pages out and in which makes my system very sluggish. I realize the wired and active memory is running current applications, but the inactive memory is not being utilized. And so the system keeps paging instead of clearing the inactive.

    And like I said, it starts out fine after a clean reboot, but I'd rather not have to reboot my computer every time I use it. Isn't there a way to clear out the virtual memory? Or at least something that will help my system use memory that is inactive? I have 8GB of RAM for goodness sake... the system should run smoothly pretty much all the time!

    Thanks.
     
  2. gnasher729 macrumors P6

    gnasher729

    Joined:
    Nov 25, 2005
    #2
    How do you know it is swapping pages out and in? That's not how "inactive memory" works. Are you just making assumptions here? Have a look at Disk Activity in Activity Monitor. What does that say? What is your CPU usage?
     
  3. Travisimo thread starter macrumors 6502a

    Joined:
    Dec 22, 2009
    #3
    Well, I can audibly hear my hard drive whenever I get the lag while doing something in an application. And iStat Menus shows the number of Page Ins and Page Outs, which are currently at 3,811,987 and 360,213 respectively (of course, my computer has been running for several days). It shows the current swap file size at 1.96 GB.

    CPU usage is low (my iMac is quad-core and I'm not doing anything cpu-intensive). But over time, a lot of activities stutter, whereas they are perfectly smooth when I first boot and the free memory is higher. Even after I shut down memory-intensive apps, it seems like it really does not make the system run smoother until I reboot. For example, I'll have both Lightroom and iMovie running to work on a video project. Obviously, these both use a lot of memory. But even after I quit out of them, the system still stutters until I reboot. It's almost like it does not actually free up the memory for use after I quite an application.
     
  4. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #4
  5. Travisimo thread starter macrumors 6502a

    Joined:
    Dec 22, 2009
    #5
    Okay, here's what mine currently shows:

    VM size: 240.56 GB
    Page ins: 15.00 GB
    Page outs: 1.38 GB
    Swap used: 1.94 GB

    Now what?
     
  6. tkermit macrumors 68030

    tkermit

    Joined:
    Feb 20, 2004
    #6
    Either get an SSD or wait for Lion to (hopefully) improve things.
     
  7. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #7
    The page outs are cumulative and the swap used represents the current size of your swap file. It doesn't decrease as swap requirements are reduced. Try restarting to reset those numbers and then monitor it to see what activities increase swap. At some point since you last rebooted, you had sufficient demands that swap occurred, but that doesn't mean it's still happening.
     
  8. ljonesj macrumors 6502a

    ljonesj

    Joined:
    Oct 20, 2009
    Location:
    Kingsport TN
    #8
    my biggest thing to eat ram is mozilla it swells to almost 2 gigs and my swap and page out then get close to that them selves so everything slows i have to do a force quite then every thing is fine for about 3hrs and it does it again mhy inacitve is fine but active ram is used is huge cause of mozilla its a mem hog
     
  9. Travisimo thread starter macrumors 6502a

    Joined:
    Dec 22, 2009
    #9
    Thanks for your description. My concern isn't so much that swap occurred during heavy demands. Sometimes, for example, I will have a lot of things running like Chrome (with many tabs), Lightroom, and an instance of Windows 7 with Parallels. Under those circumstances, I can understand when swap occurs.

    My main concern is that my system continues to run poorly even when I have closed some of those apps and my load has decreased. I'll have to do the reboot and continuously monitor things to know for sure, but it certainly seems like it continues to swap even when I have closed a lot of these apps. It's almost as if it does not free up the RAM that was being used by these programs, but continues to use the swap file until my next reboot.
     
  10. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #10
    That's not normal Mac OS X behavior, as it does a good job of managing memory without the need for rebooting. I'd keep an eye on Activity Monitor to see what's using system resources at times when things are running slow.
     
  11. gnasher729 macrumors P6

    gnasher729

    Joined:
    Nov 25, 2005
    #11
    If you used up all RAM so that some things have been thrown out of RAM, and you then exit some applications, the things that were thrown out don't come back my magic - they have to swapped in again. That doesn't happen immediately.
     
  12. ChrisA macrumors G4

    Joined:
    Jan 5, 2006
    Location:
    Redondo Beach, California
    #12
    Really? How would you know that from the above?

    Second. You don't care at all about pages being swapped in. That is the normal was UNIX-like system load programs into RAM from disk. Typically the system shoud not have to swapp data out because the program is already there on disk.

    What you care bout are swap outs. This means RAM is full and "something had to go". Look at Activity Monitor and look at the Swap out rate. If it is comparable to swap ins then you have a problem.
     
  13. ChrisA macrumors G4

    Joined:
    Jan 5, 2006
    Location:
    Redondo Beach, California
    #13
    That is exactly what it does. The system will not free up RAM until it needs it. If the system is well designed then all of the RAM should be given some productive use even if that is only to hold old data just in case it is needed. Free RAM is wasted RAM.

    One question: When you close programs you don't need are you actually "quitting" them or only clicking the red button to close the display. Killing the windows does not quit the program.
     
  14. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #14
    If you read the rest of the thread, you'll see that's already been discussed.
     

Share This Page