mightymilk

Q: Lion - Memory Usage Problems

Why is Lion using all 4GB of RAM running Mail, Safari (2 tabs), and iTunes?  Snow Leopard was bad enough at handling memory, eating up every available byte and Lion seems to be arbitrarily using even more RAM.  Windows 7 has zero problems handling RAM, there's no reason OS X shouldn't be able handle memory properly.

 

Can someone explain what Apple is doing here?  I'm at a total loss.  For users who just need Safari, Mail, and iTunes... I guess this works.  But how am I expected to reliably run Logic, Final Cut, or Aperture with OS X using every available resource for Web Surfing, E-mail, and Music.  This is totally unacceptable for a multi-million dollar software company greated towards professionals as well as consumers.

 

The following responses are not acceptable by the way:

 

  • Buy more RAM  - I did that already, it will eat up 2/4/8GB, doesn't matter.  Not to mention Apple still sells numerous 2/4GB confirgurations.
  • Buy a newer/more powerful Mac - this is a improper handling of memory issue, not a hardware issue.

 

I'd really love some insight into this.  Thanks for reading.

MacBook Pro, Mac OS X (10.7), 13" (late-2009)

Posted on Jul 21, 2011 5:47 AM

Close

Q: Lion - Memory Usage Problems

  • All replies
  • Helpful answers

first Previous Page 4 of 64 last Next
  • by mightymilk,

    mightymilk mightymilk Jul 26, 2011 12:05 PM in response to John Kitchen
    Level 1 (24 points)
    Notebooks
    Jul 26, 2011 12:05 PM in response to John Kitchen

    John Kitchen wrote:

     

    Over in the Aperture community, I posted an essay on RAM and the move to Lion which may help you.  It's probably illegal to post it again, but so what.  Shoot me!  I think this will help some people.

     

    -------------------------------------------------------------------------------- --------

     

    John Kitchen wrote:

     

    I'm going to suggest something that may explain why sometimes things go badly for one person, and go well for the next person when moving to Lion.

     

    Again it is the RAM issue.  Mac OS X (like most OSes), is a virtual storage system which squeezes a lot of potential RAM demand into a much smaller amount of RAM.

     

    What needs to be understood here is "working set".

     

    Looking at my Activity Monitor beside me, I see that the Activity Monitor process itself is consuming about 95 MB of virtual memory, whereas it is using less than 20MB of real memory.  "Real" memory is the physical stuff with the chips etc.

     

    So how can 95 fit into 20?  It can't, but what OS X has determined is that the "working set" of memory for the Activity Monitor process is less than 20MB.  The working set is that part of the process's allocated memory which is getting a lot of use, and the rest is parked on disk in case it's needed.  For example, it may be program code which is only used under unusual or different circumstances, such as text strings in languages other than the one I am currently using.

     

    The tricky thing about "working set" is that while you have enough RAM to contain that "working set", everything tends to go very, very well.  Evidence that it is working well is that "Page Outs" are zero (see Activity Monitor).

     

    But if that working set grows, then you will eventually see Page Outs happening as OS X finds that it has to swap out pages to make room for other pages.  (A "page" is 4K bytes).

     

    Within reason, a little paging is OK.  If Page Outs only happen a few times per minute, they probably won't hurt you much since they represent a work delay of only about1/100th of a second (very approximately, don't shoot me for this estimate!).

     

    The problem is that the difference  between the working set fitting and not fitting in RAM can be catastrophic with only a slight change in the working set size.  One minute, all is well, the next it's a mess.  Or really, I should say one millisecond, all is well, and the next it is a mess.  Things happen really quickly in RAM!

     

    The best analogy is the freeway.  We are all zipping along at near the speed limit in very heavy traffic,  something happens in the opposite lanes causing gawking drivers to ever-so-slightly back off on the gas and slow down just a little, and the next thing, we have a traffic snarl.

     

    Back to your Mac.  In the pre-Lion situation, if your working set for the processes you choose to use is very, very close to filling your RAM, the move to Lion may push this over the edge, causing the "traffic snarl".

     

    On the other hand, if you had plenty of spare RAM with Snow Leopard, the move to Lion will reduce that spare RAM, but not enough to cause paging to rise enough to hurt you.

     

    How can you get some insight into waht will happen when moving to Lion?  That's really hard, but what is for sure, if you are already getting Page Outs in any significant quantity, that quantity will rise with Lion unless you change your work habits (like run fewer apps at the same time).  Page Outs under Snow Leopard should send off warning bells for you to get more RAM before going to Lion.

     

    My advice is always to have more RAM than you need.

     

    In another thread, a poster said something like "Sure, Apple said you can put Lion in a 2GB Mac, but they didn't say you'd enjoy it!"

     

    Most of us replying understand how PFing works.  The problem here appears to be a very serious memory leak... which has nothing to do with having enough RAM.  As was outlined numerous times, it doesn't matter whether you have 2, 4, 8, 12, or 24GB or RAM (this has been proven in posts above)... Lion will consume all RAM eventually using nothing but Safari and/or Mail.

     

    To go into further detail, I had no memory issues under Snow Leopard nor was I close to my 4GB limit.  If I'm running Logic, Aperture, or Final Cut I will typically close down other applications to make sure these programs can draw every ounce of RAM, Processor, and HDD power.  During typical operation I had Safari, Mail, and iTunes and had anywhere from 1.5-3GB of free RAM. 

     

    I realize you're trying to help... but I'm not entirely sure that your grasping what a memory leak is.  Again it's not that your isight isn't appreciated, but we're beyond the point of this being shrugged off as "user error" anymore. 

  • by John Kitchen,

    John Kitchen John Kitchen Jul 26, 2011 12:21 PM in response to mightymilk
    Level 3 (649 points)
    Jul 26, 2011 12:21 PM in response to mightymilk

    I'm not saying that your case is user error, and I do understand what memory leaks are.  45 years in the computer industry, and credit me with having learned something please.

     

    But it's clear that not everyone with memory issues is actually presenting evidence of memory leaks.  There is more at play here.

     

    And I certainly didn't say anything about "user error".  I am merely offering the opportunity for learning, and if you want to reject that, then go ahead.  Others may find it helpful.

     

    PS, what do you mean by "PFing"

     

    Message was edited by: John Kitchen - added PS

  • by Ned Nowotny,

    Ned Nowotny Ned Nowotny Jul 26, 2011 12:50 PM in response to John Kitchen
    Level 1 (0 points)
    Jul 26, 2011 12:50 PM in response to John Kitchen

    "PFing" means "page faulting." Basically, that is the interrupt or exception raised when an application needs to access a page of its virtual address space that is on disk, but not in memory. At that point, the page is read into memory. One or more pages may be written out then or more RAM may be allocated to what you call the application's "working set." Consider it a "Page In" which is the inverse of your "Page Out." The difference is that "Page In" events are the primary driver for all virtual memory paging--though the operating system will try to optimize things a bit by adjusting the "working set" size, reading additional pages in anticipation of need, and scheduling the writing of pages to try to reduce the impact on the application and the system as a whole.

     

    In summary, "page faults" are what he meant.

  • by mightymilk,

    mightymilk mightymilk Jul 26, 2011 12:50 PM in response to John Kitchen
    Level 1 (24 points)
    Notebooks
    Jul 26, 2011 12:50 PM in response to John Kitchen

    John Kitchen wrote:

     

    I'm not saying that your case is user error, and I do understand what memory leaks are.  45 years in the computer industry, and credit me with having learned something please.

     

    But it's clear that not everyone with memory issues is actually presenting evidence of memory leaks.  There is more at play here.

     

    And I certainly didn't say anything about "user error".  I am merely offering the opportunity for learning, and if you want to reject that, then go ahead.  Others may find it helpful.

     

    PS, what do you mean by "PFing"

     

    Message was edited by: John Kitchen - added PS

     

    I'm not trying to insult your intelligence but you seem to be disregarding the information that's right in front of you.  You're basically arguing that just because everyone didn't post a Screen Shot of Activity Monitor that there's room for serious doubt.

     

    I've been heavily involved with computers for 15 years now, and I'm no slouch when it comes to trouble shooting and technical data.  Even if I wasn't well educated in computers, I'd know that 4GB of RAM lost on iTunes, Mail, and Safari (3 tabs) just doesn't sound right.

     

    I have no doubt you have experience with computers, but my experience tells me that you're missing the mark on this one.  You shouldn't take it personal, but since you're replying to my thread I felt the need to tell you that I feel like your information is totally unrelated to the issue at hand.

     

    I appreciate your response, I just fail to see the relevance to our particular problem.  That's all.

  • by Orukaz,

    Orukaz Orukaz Jul 26, 2011 12:56 PM in response to mightymilk
    Level 1 (0 points)
    Jul 26, 2011 12:56 PM in response to mightymilk

    And another thing which is very annoing and it may be caused by memory issue is that: when i am scrolling with mouse or touchpad whole computer freezes for several seconds (only mouse cursors moves). Also Flash movie watching causes freezing. That problem is on my both computers. And sometimes only open program freezes and if I open another program and move back to that first program scrolling is moved on. And then freezes again then I scroll, nothing happens and then click to another program and move back and scroll has moved again. Strange.

     

    I am very dissapointed, the new OS X is not that I expected!

     

    Something is needed to be done quickly by Apple it disturbing and makes my work very slow.

  • by John Kitchen,

    John Kitchen John Kitchen Jul 26, 2011 2:49 PM in response to Ned Nowotny
    Level 3 (649 points)
    Jul 26, 2011 2:49 PM in response to Ned Nowotny

    Ned Nowotny wrote:

     

    In summary, "page faults" are what he meant.

    That's what I was guessing, but I like to be precise.  Some may use that term to include or not include soft faults, depending on where they came from.

  • by John Kitchen,

    John Kitchen John Kitchen Jul 26, 2011 3:07 PM in response to mightymilk
    Level 3 (649 points)
    Jul 26, 2011 3:07 PM in response to mightymilk

    mightymilk wrote:

     

    <snip>

    I'm not trying to insult your intelligence but you seem to be disregarding the information that's right in front of you.  You're basically arguing that just because everyone didn't post a Screen Shot of Activity Monitor that there's room for serious doubt.

     

     

    On the contrary, what I'm doing is expanding on what has been written. 

     

    For your particular memory issue, the problem is memory leaks, but others who visit this thread may have different "Lion - Memory Usage Problems" to quote the title of this discussion.

     

    There are many other discussions dealing with memory-related issues, not just your particular problem.

     

    I must remember that line "I'm not trying to insult your intelligence but...."

  • by mfpearson,

    mfpearson mfpearson Jul 26, 2011 4:34 PM in response to mightymilk
    Level 1 (0 points)
    Jul 26, 2011 4:34 PM in response to mightymilk

    not sure if people missed this, because i read through this entire thread, and it seems that it veered from the original subject a little bit... or at least went into too much technical information for an average user like me.

     

    on page 2, somebody recommended upgrading adobe flash on adobe's website.  i think the latest version is 10.3.

     

    i was having the exact same problems described by everyone in here - safari and mail were eating up an inordinate portion of my ram - on a 2009 MBP 17" unibody with 4GB ram, i would constantly have 3.7 used, 0.3 free.  i would use "icleanmemory" to reset the ram, and it would jump back to its previous values within seconds.

     

    i downloaded the latest flash player from adobe, installed it, and i can happily say that the problem seems to have disappeared completely.  now, with safari, mail, and itunes running (up to 8 tabs in safari), i haven't seen my ram usage go above 1.6 GB used.

     

    also, an obvious corollary to the decrease in ram consumption is that my macbook pro now runs much cooler - between 130 and 140 degrees farenheit with normal usage, usually in the low 130's (before installing the latest flash player, i couldn't keep it below 155 degrees, and it usually got up into the 160s-170's with simple web browsing).  i read a thread about increased temperature since installing lion, as well, and this flash player update seems to have solved that problem.

     

    so there you have it - 2 birds with one stone.  hopefully it will continue working for me, and i won't have to come back and edit this post.  but if you haven't done this yet, please give it a try.  so far, it is a complete fix.

  • by Thebestplacehere,

    Thebestplacehere Thebestplacehere Jul 26, 2011 4:43 PM in response to mightymilk
    Level 3 (717 points)
    Jul 26, 2011 4:43 PM in response to mightymilk

    Lion really like ram and macs now can have more ram so apple is waiting us to upgrade to take advantage of Lion and all the computer power ..

  • by R C-R,

    R C-R R C-R Jul 26, 2011 4:48 PM in response to mightymilk
    Level 6 (17,700 points)
    Jul 26, 2011 4:48 PM in response to mightymilk

    mightymilk wrote:

    I'm not trying to insult your intelligence but you seem to be disregarding the information that's right in front of you.  You're basically arguing that just because everyone didn't post a Screen Shot of Activity Monitor that there's room for serious doubt.

    By itself, Activity Monitor will not tell you if an app has a memory leak or if something is using "too much" memory. In the Mac OS, any 32 bit process can have up to up to 4 GB of addressable memory space allocated to it; for 64 bit processes the max is 18 exabytes -- far more than any Mac can provide.

     

    To make this work, the OS relies heavily on virtual memory, storing data not currently in use on the hard disk & paging into & out of physical memory only what is needed. The details of how & when it does this are not visible to the user. Nor is it a simple process: for instance, only a small part of what is in physical memory may need to be paged out; much of it can usually simply be discarded. (For the details, see this developer document, in particular the “About the Virtual Memory System” section.)

     

    To track memory use, for instance to see if an app has a memory leak, you must use the tools & techniques mentioned in the above document. Just looking at the total free & used memory, or the memory numbers Activity Monitor shows you for each process, does not begin to provide enough info to tell anyone what's really going on.

  • by harmonica01,

    harmonica01 harmonica01 Jul 27, 2011 12:08 AM in response to R C-R
    Level 1 (0 points)
    Jul 27, 2011 12:08 AM in response to R C-R

    I'm glad I am not the only one having this issue.  I posted on macrumors the day it came out that this was going on and was rebuked as trying to find a reason to hate the new operating system.  My laptop is the santa rosa late 2008 macbook unibody 2.4.  I have 4 gb ram dd3 recognized by system profiler, but even with safari and mail closed the system is sluggish.  Just trying to load apple.com in firefox with nothing else open shows me 3.96gb used on activity monitor and less than 100mb obviously free.

     

    This is unbearable and unacceptable for a realtively new apple, not sure what's going on here but my fan stays on full blast all the time now.

     

    Have ordered an 8gb ram pack from crucial which may or may not help, we'll see.  And also am doing an install clean from DVD tomorrow afternoon.

  • by Gogolathome,

    Gogolathome Gogolathome Jul 27, 2011 3:38 AM in response to mightymilk
    Level 1 (0 points)
    Jul 27, 2011 3:38 AM in response to mightymilk

    I have a similar issue. A website with a flash game. I opened Activity monitor and saw Safari quickly climbing to 3Gb of physical RAM usage and a spinning beach ball when opening the game.

     

    For me I found a solution. I had just one extension running: 1password. As a test I disabled all extensions in preferences and all was well. I could not even open this page under Snow Leopard with no extensions loaded and now with Lion I can

  • by mightymilk,

    mightymilk mightymilk Jul 27, 2011 5:17 AM in response to R C-R
    Level 1 (24 points)
    Notebooks
    Jul 27, 2011 5:17 AM in response to R C-R

    R C-R wrote:

     

    mightymilk wrote:

    I'm not trying to insult your intelligence but you seem to be disregarding the information that's right in front of you.  You're basically arguing that just because everyone didn't post a Screen Shot of Activity Monitor that there's room for serious doubt.

    By itself, Activity Monitor will not tell you if an app has a memory leak or if something is using "too much" memory. In the Mac OS, any 32 bit process can have up to up to 4 GB of addressable memory space allocated to it; for 64 bit processes the max is 18 exabytes -- far more than any Mac can provide.

     

    To make this work, the OS relies heavily on virtual memory, storing data not currently in use on the hard disk & paging into & out of physical memory only what is needed. The details of how & when it does this are not visible to the user. Nor is it a simple process: for instance, only a small part of what is in physical memory may need to be paged out; much of it can usually simply be discarded. (For the details, see this developer document, in particular the “About the Virtual Memory System” section.)

     

    To track memory use, for instance to see if an app has a memory leak, you must use the tools & techniques mentioned in the above document. Just looking at the total free & used memory, or the memory numbers Activity Monitor shows you for each process, does not begin to provide enough info to tell anyone what's really going on.

     

    No matter how you try and paint it.  If all Free and Inactive Memory is consumed by Mail, iTunes, or Safari... that's a problem.  You can try and lecture me about Page Filing and how it's an intended design, as if I don't already know.  But at the end of the day, this problem is being validated by numerous users.

     

    So unless you'd like to argue that it's normal for Safari (with 3 tabs open) to use 2GB of RAM... or Mail to be using 4GB of RAM.  I see no point in continuing this conversation.

  • by R C-R,

    R C-R R C-R Jul 27, 2011 8:45 AM in response to mightymilk
    Level 6 (17,700 points)
    Jul 27, 2011 8:45 AM in response to mightymilk

    mightymilk wrote:

    No matter how you try and paint it.  If all Free and Inactive Memory is consumed by Mail, iTunes, or Safari... that's a problem.

    It isn't that simple:

     

    First, running with almost no free memory may just be because the memory manager is retaining a lot of resources in inactive memory for later use. Free memory is immediately available because it is not being used for anything. Inactive memory contains data that isn't actively being used but may be used later. When more real memory is needed, if the memory manager determines some of the data in inactive memory will not be used again, it will either be purged outright (if it does not need to be saved to disk) or written back to disk (paged out) & then purged. But Activity Monitor does not show what is in inactive memory, or if or when it will be reused. So just looking at the total free & inactive memory numbers, or the real, virtual, etc. numbers for a process, won't by itself tell you if there is a memory use problem or not.

     

    Second, if there really is a memory use problem, it is not necessarily due to a memory leak or any other flaw inherent in the app. For example, as several reports in this discussion make obvious, the problem may well be an incompatible or out-of-date third party add-on. What isn't so obvious is this can include some additions that seem totally unrelated to the app using up memory. This isn't uncommon when upgrading the OS -- some additions are patched onto often used routines & if not fully compatible with the new OS can cause unpredictable behavior in any process that uses those routines.

     

    For things like this, Activity Monitor may be able to tell you that you have a problem, but it can't tell you its cause. For that, you need to use other tools & troubleshooting techniques. For instance, a safe boot or logging into a newly created test user account may help with this, or checking system logs. If you just assume the app itself is at fault without investigating other possible causes, you may overlook the real one & never eliminate it.

  • by ColoradoiPodUser,

    ColoradoiPodUser ColoradoiPodUser Jul 28, 2011 6:40 AM in response to R C-R
    Level 1 (4 points)
    Jul 28, 2011 6:40 AM in response to R C-R

    This morning, after leaving my Macbook run all night with no apps launch I come to a machine with only a couple hundred MB of free memory.

     

    Is this not a memory leak?  I have the same thing happen after a day of normal use (with several apps running).

     

    Now the system doesn't seem to be especial slow, but I was told a while ago by a "Genus" at an apple store when available memory gets low I should reboot.

     

    Is Lion just managing memory much differently from OS X 10.6.??

first Previous Page 4 of 64 last Next