Forcing OS X to free up memory

Discussion in 'macOS' started by C64, Jul 29, 2010.

  1. C64, Jul 29, 2010
    Last edited: Nov 25, 2011

    C64 macrumors 65816

    C64

    Joined:
    Sep 3, 2008
    #1
    I was looking for ways to speed up my MacBook, which led me to the following question which is more OS X related.

    Scenario
    Say I'm using a lot of apps at the same time, along with a few browsers like Safari and Chrome with a lot of tabs. At this point everything gets noticeably slower. It especially takes a while to switch between apps. Need to wait a bit every time before I can actually do something again. Opening new tabs/sites takes a long time, lots of spinning beach balls in Safari.

    Memory/CPU usage
    Screenshot from my Activity Monitor for a situation like that:

    From what I could find on Google it's best to keep the Page outs as low as possible, and about 5-10% max relative to the Page ins. As you can see it's now at 25% which can't be good. *

    Not much going on with the CPU. Safari is, with many tabs open, using up about 12-14% CPU. The rest of the apps are all at ~0,0 to 3,0% max.

    Question
    Now the problem. When I close most of the applications and go back to a browser with a few tabs and 4-5 other apps, the memory usage still stays the same for a long time. Things get faster, but not much. Still a lot of Page outs, and all the memory stays in use. Does anyone know why this is?

    Isn't there a way to tell OS X to "flush" or "rebuild" all the reserved memory? Because when I do a reboot and start e.g. 5 apps, they seem to take up way less memory than when I start 20 apps, close 15 and have those 5 apps open.

    * I ordered more RAM, but in the end I'll keep ending up having the same "problem", albeit after using a few more apps
     
  2. iBookG4user macrumors 604

    iBookG4user

    Joined:
    Jun 27, 2006
    Location:
    Seattle, WA
    #2
    I use ifreemem and it works great for exactly what you're looking for :)
     
  3. C64 thread starter macrumors 65816

    C64

    Joined:
    Sep 3, 2008
    #3
    Wow, that looks very promising! Thanks :)
     
  4. iBookG4user macrumors 604

    iBookG4user

    Joined:
    Jun 27, 2006
    Location:
    Seattle, WA
    #4
    No problem, glad to help :)
     
  5. smithrh macrumors 68020

    smithrh

    Joined:
    Feb 28, 2009
    #5
    Or, use Disk Utility and run "repair disk permissions" on your boot disk.

    Yes, I'm serious, try it...
     
  6. mabaker macrumors 65816

    mabaker

    Joined:
    Jan 19, 2008
    #6
    It does wonders. Especially on Snow Leopard as it’s horrible with RAM management.
     
  7. peoplevoice macrumors member

    Joined:
    Aug 19, 2008
    #7
    It's true

    It works. Thanks a lot!!!!
     
  8. smithrh macrumors 68020

    smithrh

    Joined:
    Feb 28, 2009
    #8
    OK - I've in the past railed about the way the inactive memory grows and grows (and swapping starts) - but I think it's highly aggressive memory management at work here.

    So, I wouldn't say it's horrible, it's just retentive; it hangs on to data for a loooooong time. The benefit is that if you access the app or data again, boom, it's right there, no disk access needed. That's great, but then it hangs onto data for too long and you're into swapping.

    Given this, I no longer consider 4 gigs of RAM to be as spacious as I used to. My next Mac will have at least 8 if not 12. I also used to think this was a bug, now I believe it's just how Apple wants to use the RAM that you have.

    Also, running Parallels tends to have an impact, I'll get to swapping a lot more quickly if Parallels is or has run since I've rebooted. If I reboot and never run Parallels, I'll tend to get up to 75-80% and not go much past that point.
     
  9. mrchinchilla macrumors 6502

    mrchinchilla

    Joined:
    Mar 6, 2009
    #9
    I wouldn't use iFreeMem, it's just an application version of something you already have called "purge". You can run it from Terminal, the machine will seem to freeze for about 5-10 seconds, as with iFreeMem, but when it finishes you see it has cleared all inactive memory.
     
  10. MisterMe macrumors G4

    MisterMe

    Joined:
    Jul 17, 2002
    Location:
    USA
    #10
    You're on a fool's errand. Free RAM is wasted RAM. MacOS X's UNIX VM system will expand the RAM required by each running task to consume the available RAM.
     
  11. smithrh macrumors 68020

    smithrh

    Joined:
    Feb 28, 2009
    #11
    You may be right. On the other hand, there is swapping when you run out of RAM, which is not good. Of course, there's a limit to which the data and application structures will use in RAM, it's not infinite.

    That's the point that a lot of people tend to miss and dismiss in these "I have no free RAM left" threads. They say exactly what you said, but then they're silent when confronted with the fact that there's swapping that impacts system performance. Or, they tell me I have some other issue - which is possible but not really likely.

    In short, the VM algorithms for Mac OS X (especially Leopard) are simply overly retentive in a decent attempt to get some performance gains. There's a tradeoff involved, and it involves swapping data in RAM to disk that could be simply cleared instead.
     

Share This Page