You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

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:45 AM

Reply
957 replies

Aug 2, 2011 10:39 AM in response to pimeye

pimeye wrote:


I'm running a MacBook Pro (first of the unibodies) 2.8GHz Core 2 Duo, 4GB RAM 1067 MHz DDR3


I'm running a Mid-2009 13" 2.26Ghz Core2Duo, same RAM. I guess I was just wondering if there's any correlation between the memory issues some of us are describing and our hardware. Since not everyone seems to be affected. It's a long shot, but just trying ot rule things out.

Aug 2, 2011 10:46 AM in response to John Kitchen

John Kitchen wrote:


For a really full discussion go to this link.

FWIW, that link is a PDF version of the same developer documentation I linked to in an earlier post. It is the same link found at the bottom of http://support.apple.com/kb/ht1342, the KBase article mightymilk mentioned in his recent post.


Some things from that doc to consider (somewhat simplified & condensed):


The kernel controls moving pages among the active, inactive, & free lists as needed. It does this based on a threshold determined by the size of physical memory. (See page 12 of the PDF.) Among other things, this means that adding more physical memory (RAM) will not necessarily increase the amount of free memory.


Moving memory pages to the free list is a multi-step process. They must first be moved to the inactive list, & then paged out to disk. However, if the data they contain has not been modified, they can simply be "stolen"-- the pages are immediately moved to the free list without the need to page anything out.


Pages in RAM are often moved between the active & inactive lists. If a process needs data from an inactive page, a soft fault occurs & that page is simple moved back to the active list. A hard fault occurs when the data has been paged out & is no longer in RAM. Hard faults affect performance because the data has to be paged back into RAM from the disk again. It is a very slow process compared to moving pages in RAM, which really just changes which list they are in without touching the data itself.


For this reason, the kernel tries to retain data in inactive memory. It does not move pages to the free list unnecessarily. If it did, hard faults would occur much more frequently, regardless of how much RAM is installed.


Note that Activity Monitor won't tell you much about this. There could be dozens of soft faults occurring between each of its samples of memory use, making it seem like the contents of inactive memory is not changing when in fact it is. As mentioned many times, the best indicator you will get about memory needs from Activity Monitor is the page out numbers. If they are low, the system is not running out of RAM, even if there is very little free memory.

Aug 2, 2011 11:09 AM in response to mightymilk

Page Filing, Paging, or PFing is just a Windows terms for what OS X calls Page In and Page Out. The two processes are very similar in nature.

They are similar only to the extent they both involve moving data between RAM & disk storage. Data must always be moved into RAM (paged in) to be used. It may or may not need to be moved back (paged out) to disk. This is true for all modern OS's, although the details of how & when page outs are handled may differ significantly from OS to OS.


However, the basic goal is the same for all performance-oriented OS's: avoid unnecessary paging between RAM & disk because it takes so long to do, relatively speaking. This usually means keeping paged in data in RAM until there is no longer a need for it.

Aug 2, 2011 11:25 AM in response to ColoradoiPodUser

As long as hardware is cheaper than software dev, we will continue to see things get blotted.

If you mean RAM use, the determining factor is how fast data can be moved between RAM & non-volatile storage like HD's or SSD's. The slower that is, the greater the performance penalty for not keeping everything in RAM that you can.


Apps could be designed to have tiny RAM footprints, but they would be insufferably slow.


That won't change until & unless the hardware can move data from storage devices into RAM as quickly as the system can use it. Given that systems run on multicore CPU's & GPU's that can process data many times faster than even the fastest hardware interfaces can support, that isn't going to happen in the foreseeable future.

Aug 2, 2011 12:02 PM in response to ColoradoiPodUser

ColoradoiPodUser wrote:

Yet if I add up the running process' "Real Memory" it never seems to total with what it seems to indicate is being used. Again never saw anything like this under Snow Leopard

You should have seen the same thing with Snow Leopard or Leopard. "Real memory" shows you how much RAM the process is using, but not how much of it is wired (can't be paged out), active (currently in use), or inactive (not currently in use). In addition, some of this memory may be shared with other processes & some of it is private (reserved for that process' use alone).


Activity Monitor doesn't show you how this is distributed among these different categories of RAM. The pie chart & numbers related to it just tell you the totals for all processes. Moreover, it changes much faster than Activity Monitor can track.


So basically the column totals won't add up to the numbers at the bottom because they aren't the total of the same things.


This has not changed in Lion.

Aug 2, 2011 12:22 PM in response to R C-R

R C-R wrote:


Page Filing, Paging, or PFing is just a Windows terms for what OS X calls Page In and Page Out. The two processes are very similar in nature.

They are similar only to the extent they both involve moving data between RAM & disk storage. Data must always be moved into RAM (paged in) to be used. It may or may not need to be moved back (paged out) to disk. This is true for all modern OS's, although the details of how & when page outs are handled may differ significantly from OS to OS.


However, the basic goal is the same for all performance-oriented OS's: avoid unnecessary paging between RAM & disk because it takes so long to do, relatively speaking. This usually means keeping paged in data in RAM until there is no longer a need for it.

I only ment they were similar in the intended purpose. Obviously being from a completely different OS written under a completely different programming language, they will never be identical. However the end goal is very much the same, it's just approcached differently. No different than USB vs Firewire, or CrossFire vs SLI.

Aug 2, 2011 12:28 PM in response to R C-R

R C-R wrote:


As long as hardware is cheaper than software dev, we will continue to see things get blotted.

If you mean RAM use, the determining factor is how fast data can be moved between RAM & non-volatile storage like HD's or SSD's. The slower that is, the greater the performance penalty for not keeping everything in RAM that you can.


Apps could be designed to have tiny RAM footprints, but they would be insufferably slow.


That won't change until & unless the hardware can move data from storage devices into RAM as quickly as the system can use it. Given that systems run on multicore CPU's & GPU's that can process data many times faster than even the fastest hardware interfaces can support, that isn't going to happen in the foreseeable future.


You and I agree completely in this regard. The HDD is the single biggest limiting factor when it comes to modern computers. SSD's are a step in the right direction, but they still can't keep up with Processors and Memory, the data throughput just isn't there yet.


However, I still think there's an issue with possibly Inactive RAM being released properly... I'm not completely against holding data in memory that require quick access. But from what I've seen in Lion, it seems like Inactive RAM isn't being released to programs that need it effeciently or possibly at all, and I think this is where the heavy Page Outs start to occur, and that is where performance suffers.

Aug 2, 2011 1:03 PM in response to mightymilk

I'm not completely against holding data in memory that require quick access. But from what I've seen in Lion, it seems like Inactive RAM isn't being released to programs that need it effeciently or possibly at all...

Activity Monitor can't tell you anything about what specific data is being held in inactive memory, or why it is. This is equally true for any version of OS X to date, not just Lion.


If anything, the trend over the last few OS versions is toward processes that allow the kernel to better determine what can be reused & thus kept in RAM longer to improve performance. I suspect users sometimes mistake this for memory management problems, especially for an app hogging "too much" memory.


It really does take special tools & techniques to determine if this is really true. In fact, without access to the source code, it is very difficult even to use the developer tools to (for example) decide where to insert break points to sample memory use in an app suspected of poor use of memory resources.


Of course, if page outs are going crazy or the system is reduced to snail-speed something is clearly wrong with it, but determining what is causing that usually isn't as simple as we would like it to be.

Aug 2, 2011 1:56 PM in response to R C-R

R C-R wrote:


I'm not completely against holding data in memory that require quick access. But from what I've seen in Lion, it seems like Inactive RAM isn't being released to programs that need it effeciently or possibly at all...

Activity Monitor can't tell you anything about what specific data is being held in inactive memory, or why it is. This is equally true for any version of OS X to date, not just Lion.


If anything, the trend over the last few OS versions is toward processes that allow the kernel to better determine what can be reused & thus kept in RAM longer to improve performance. I suspect users sometimes mistake this for memory management problems, especially for an app hogging "too much" memory.


It really does take special tools & techniques to determine if this is really true. In fact, without access to the source code, it is very difficult even to use the developer tools to (for example) decide where to insert break points to sample memory use in an app suspected of poor use of memory resources.


Of course, if page outs are going crazy or the system is reduced to snail-speed something is clearly wrong with it, but determining what is causing that usually isn't as simple as we would like it to be.

R C-R,

You misunderstand me. I'm not saing I know specifically what is causing the problem, and while I believe it is a memory leak that is nothing more than a hunch based on my experiences. Other people are expressing similar memory issues with Mail, these may or may not be related and more importantly, are obviously not easy for anyone here diagnose.


Kernel can be monitered under Activity Monitor, and while I realize that updates are not in real time... most of us have looked at Activity Monitor long enough to know the trend of the way the overall memory is being handled by the system. We know it's different than previous versions of OS X, and for those of us experiencing serious performance issues... that's enough to warrant doubt that OS X 10.7 is working properly.


I can tell you in all honesty (if you choose to believe my claims), that everytime I notice performance issues I open Activity Monitor... all Free RAM is gone leaving only Inactive, Wired, Active. In no other circumstance is Free RAM completely consumed. I can also tell you there is heavy Page Out/Swap activity.


Honestly, with all due respect this is not just a coincidence and given the relatively simple tasks I'm running when it happens... it's not expected from a semi-recent Mac computer.

Aug 2, 2011 2:50 PM in response to mightymilk

mightymilk wrote:

I can tell you in all honesty (if you choose to believe my claims), that everytime I notice performance issues I open Activity Monitor... all Free RAM is gone leaving only Inactive, Wired, Active. In no other circumstance is Free RAM completely consumed. I can also tell you there is heavy Page Out/Swap activity.

I do believe you. But do keep in mind that I often see almost no free memory available in both Snow Leopard & Lion, even when doing nothing resource-intensive. The difference is I don't see any appreciable performance issues or spikes in page outs when that happens.


You obviously have a problem that I don't. I don't think the problem is intrinsic to the OS or Safari or Mail -- if it was I think it would affect everyone, or at least everyone with a specific model or configuration or whatever. But since the reports vary so much, I think we are seeing a number of different problems, each with its own cause.

Aug 2, 2011 3:34 PM in response to R C-R

R C-R wrote:


mightymilk wrote:

I can tell you in all honesty (if you choose to believe my claims), that everytime I notice performance issues I open Activity Monitor... all Free RAM is gone leaving only Inactive, Wired, Active. In no other circumstance is Free RAM completely consumed. I can also tell you there is heavy Page Out/Swap activity.

I do believe you. But do keep in mind that I often see almost no free memory available in both Snow Leopard & Lion, even when doing nothing resource-intensive. The difference is I don't see any appreciable performance issues or spikes in page outs when that happens.


You obviously have a problem that I don't. I don't think the problem is intrinsic to the OS or Safari or Mail -- if it was I think it would affect everyone, or at least everyone with a specific model or configuration or whatever. But since the reports vary so much, I think we are seeing a number of different problems, each with its own cause.


I won't speak for everyone, but I watch Activity Monitor closely... it's actually the only application I have set as a Login Item under System Pref. I can say this is a drastic difference from any previous version of OS X, for me. Other people seem to be saying that as well.


I know your experiences differ, but I do believe something in Lion is causing this, it all started after just a few hours of using it. If I wasn't experiencing performance issues, I wouldn't make a fuss. But I take a lot of care in optimizing all of my computers; Windows, OS X, and Linux.

Aug 3, 2011 3:05 PM in response to mightymilk

I also have had problems with OS X Lion. On my iMac (a mid 2010 3.06GHz dual core 2 duo with 4 Gb of RAM) the computer just freezes and a hard reset does not resolve the problem; I get the start up tone and then the loading disk spins in perpetuity. I restored the iMac, assuming that there had just been a 'glitch' and within the space of less than 24 hours, I had to do it again. Having subsequently searched the web I noted that I am not alone and worryingly a YouTube post shows a far higher spec machine than mine (newer and with 16Gb of RAM) running alarmingly slowly. I have now restored my Snow Leopard installation as Lion is currently unworkable for me and will not install the upgrade that I have already paid for until Apple produce a suitable patch to resolve the issues that appear to be fairly widespread. I am suprised that Apple appear to be Beta testing their latest operating system in the market place - I moved away from the PC market because I was fed up with problem after problem as immature operating systems were marketed as polished product. Whilst I appreciate that no software product will ever be perfect out of the box, Apple have less scope to get it wrong than the PC market because they control their product specification. How have they got it so badly wrong this time?

Lion - Memory Usage Problems

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.