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 9, 2011 6:50 AM in response to jesslorenzo

jesslorenzo wrote:


ayrtonoc:


How do you boot at 32bit kernel?


With Snow Leopard, you could hold the "3" and "2" key during Startup to launch in 32-bit Mode. It will revert back to 64-bit by default on the next startup, unless you hold those keys everytime. There is a terminal command to make it permanent, those details are on Apple's Support pages.

Aug 9, 2011 7:08 AM in response to Michelasso

Michelasso wrote:

The problem is that it seems the OS X Lion memory management system is screwed. Otherwise it wouldn't explain why, when still having 1GB of free memory (mostly inactvie) sometimes it starts paging out like crazy making in my case a swap area of 1.2GB or so.

What do you mean by "free memory (mostly inactvie)"? Free & inactive memory are two different things.


Also, what do you mean by "a swap area of 1.2GB or so"? Which (if any) numbers in Activity Monitor are you getting this from?


Please remember that Activity Monitor can't tell you how inactive memory is apportioned to different processes or why it isn't being released to the free memory pool. A process may have used code or data in RAM that it is not currently using but might use again. The OS will try to retain it as part of the inactive memory footprint of the process for as long as it might be useful.


That means that for say Safari, it isn't just the currently open web pages that contribute to its inactive memory use, but also other web pages that have been opened since the app was launched. That includes the code & data used by ads, browser plug-ins, Javascripts, & any other content a web page might contain. Neither Activity Monitor nor just looking at the visible content of the web pages will tell you how much memory a web page actually uses. You can get a rough idea of this by looking at its source code ("View Source" for Safari), but unless you are familiar with Javascript & other web page constructs & do a careful analysis, even that will be only a very rough indicator. Pages that contain ads or complex Javascripts can be particularly deceptive in this respect since they often load a lot of stuff that isn't visible & may not even be used unless you click on them.

So for some of you, what looks like Safari using excessive memory might instead be the result of viewing some resource-hungry web pages, even if they are not currently being displayed. Also, don't overlook the possibility of browser plugins or extensions that are not fully compatible with Lion, poorly written Javascripts, & so on.

Aug 9, 2011 7:23 AM in response to R C-R

R C-R wrote:

Please remember that Activity Monitor can't tell you how inactive memory is apportioned to different processes or why it isn't being released to the free memory pool. A process may have used code or data in RAM that it is not currently using but might use again. The OS will try to retain it as part of the inactive memory footprint of the process for as long as it might be useful.



What you say is correct, but even with ALL applications closed, i have A LOT of inactive memory on 64bit kernel. That doesen't happen in 32bit kernel mode.

Aug 9, 2011 7:46 AM in response to Dogcow-Moof

William Kucharski wrote:

So are all of you seeing pinwheels or just objecting to the numbers in Activity Monitor?

For this discussion to be helpful to anyone, this is something everyone must make clear in their posts.


High memory use as shown by Activity Monitor is not by itself a symptom of any problem. Despite what some think, an app like Safari may use many GB's of available RAM to support its new features. That is what RAM is for. It would be a problem if it did not use it.


OTOH, if high memory use is accompanied by performance issues, you obviously do have a problem, but keep in mind that it may not be caused by high memory use. That could be a symptom of the real cause. That cause may be something that only Apple can fix, but it might also be something users can fix.


Either way, the more info you can provide the easier it will be to figure out what the appropriate remedy is for you. Don't assume that will be the same thing for everyone. It almost certainly won't be.

Aug 9, 2011 7:48 AM in response to Dogcow-Moof

William Kucharski wrote:


RIght - reading and writing is much slower than reading directly from RAM, which is why it's to the system's advantage to cache as much as possible in RAM; cached blocks are what inactive memory largely is.


The general speed "stack" in increasing amount of time is:


  • processor cache
  • RAM cache
  • swap file
  • local file system
  • network file system (LAN)
  • network file system (WAN) or internet


Where this becomes tricky is if the user sees a "UI not hitting the interactivity timer" cursor (the pinwheel) for three seconds compared to say six seconds spent reading a file from the file system, but the latter activity would not display the pinwheel, would the user perceive the three seconds to be longer?


Note that utilties to flush the caches are developer tools for a reason - so developers can get a handle on what "from filesystem" performance is compared to when the application is cached.


They've become popular as many people do look at Activity Monitor and misinterpret the lack of free memory as somehow being a problem.


(As I said before, if the system becomes less responsive that is a problem.)


It's important to note, a lot of us are experiencing performance issues.


My personal experience is that after all Free RAM has been used up, the Inactive RAM is not being purged back to the System as needed or to the Applications that need it. I start seeing heavy Page Out activity as a result. That's when my system starts to take a serious performance hit.

Aug 9, 2011 8:00 AM in response to R C-R

R C-R wrote:


Michelasso wrote:

The problem is that it seems the OS X Lion memory management system is screwed. Otherwise it wouldn't explain why, when still having 1GB of free memory (mostly inactvie) sometimes it starts paging out like crazy making in my case a swap area of 1.2GB or so.

What do you mean by "free memory (mostly inactvie)"? Free & inactive memory are two different things.


Also, what do you mean by "a swap area of 1.2GB or so"? Which (if any) numbers in Activity Monitor are you getting this from?

I am using mostly iStat Menus to monitor my resources. So I see Free memory plus Inactive memory as "available" memory. Let me rephrase it: still having 1GB of available memory (mostly inactive) Lion starts paging like crazy.


iStat Menus also shows which is the size of the swap memory really paged out. As I wrote sometime suddendly it goes from 0 to 1.2GB just doing nearly nothing and still having plenty of available memory.


It's not the issue how the inactive memory has been allocated. On which you are correct anyway. My idea was that the kernel, once it is low in free memory, first frees memory from the inactive memory list and only if none is available it starts paging out. That doesn't seem to be the case. Instead Lion seems to page out the inactive memory and only then it reallocates to the requesting processes the freed memory. Which, in my modest opinion is either a bug or a very dumb decision.


The inactive memory should be a sort of cache for the pages on the disk that have already been read.If a process requests a page that had already been allocated and it is present in the inactve memory it reallocates it from there. Otherwise from the free memory. If the free memory is below the low water mark, OS X should free a bunch of pages from the inactive memory. I have been monitoring the memory usage in the last few days and as far as I could check none of that happened. I also disabled the virtual memory manager (dynamic_pager) for testing, and with 3GB of RAM OS X was running happy even pushing the system much more than what I do on normal usage, where I still get high paging activity (I started a Win7 64 bit virtual machine on top of my regular applications). Well, the CPU suffered obviously, but in terms of memory it was just fine.


In other words I have no idea what Apple did with Lion. I just know that in SL I rarely saw paging activity, in Lion it appears to be the norm.

Aug 9, 2011 8:01 AM in response to ayrtonoc

ayrtonoc wrote:

What you say is correct, but even with ALL applications closed, i have A LOT of inactive memory on 64bit kernel. That doesen't happen in 32bit kernel mode.

Why does this concern you? Even when all user-launched processes have been quit, system processes continue to run. If there is no demand for active memory from other processes, there is no reason to release the inactive memory they have used.


As William Kucharski said, free memory is (at least in one sense) wasted memory -- it isn't being used for anything. RAM is a resource meant to be used. If the OS isn't using it, what is the point of having it?

Aug 9, 2011 8:13 AM in response to R C-R

R C-R wrote:


Why does this concern you?


I thiks that's a VERY LARGE BUG because Michelasso had summarized very well the situation:


"It's not the issue how the inactive memory has been allocated. On which you are correct anyway. My idea was that the kernel, once it is low in free memory, first frees memory from the inactive memory list and only if none is available it starts paging out. That doesn't seem to be the case. Instead Lion seems to page out the inactive memory and only then it reallocates to the requesting processes the freed memory. Which, in my modest opinion is either a bug or a very dumb decision."


So why the system use page file, in 64bit mode, before freeing inactive memory??

Why the 32bit kernel frees that portion of memory before using paging file??


That's the matter!!

And is not related to ANY scientific theory of memory use: is a fault.

Aug 9, 2011 8:12 AM in response to mightymilk

mightymilk wrote:


It's important to note, a lot of us are experiencing performance issues.


My personal experience is that after all Free RAM has been used up, the Inactive RAM is not being purged back to the System as needed or to the Applications that need it. I start seeing heavy Page Out activity as a result. That's when my system starts to take a serious performance hit.


Right. That's exactly what I wanted to explain in my previous post.

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.