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 4:22 AM in response to mightymilk

Just as I suspected. Most of us should not have any page out activity. Also, "Inactive" memory is included in the number for used memory.


This is straight from Lion's help menu for Activity Monitor.




"As you’re working, look at the number in parentheses beside “Pages out” in the Activity Monitor window.

If that number is above zero, adding RAM could improve your computer’s performance."



I just added all the ram I could add for Lion - 4gbs to 8gbs. There is something going on here with Lion.

Aug 9, 2011 4:34 AM in response to urabus

This is staright form the Mac OS X Developer Library.


"Paging of any kind, and disk thrashing in particular, affects performance negatively because it forces the system to spend a lot of time reading and writing to disk. Reading a page in from the backing store takes a significant amount of time and is much slower than reading directly from RAM. If the system has to write a page to disk before it can read another page from disk, the performance impact is even worse."

Aug 9, 2011 4:44 AM in response to urabus

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.)

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

William Kucharski wrote:


Note that hangs/spins are not normal operation, but it's no big deal if Safari is using all of RAM as long as the inactive memory is effectively reclaimed when needed.

Exactly!!! As long as..


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. Which is a lot on my poor old MB late 2006 with 3G.


It looks like there is a bug (hopefully. If it is a design choice I am afraid Apple lost some OS designer gurus) when the free memory reaches the low water mark. Instead of getting the memory from the inactive one (if available) it decides to virtualize it. Making the system unusable for at least 20 seconds while fillng the new swap space.


That's why the "purge" command from Xcode gets useful. Freeing the inactive memory it avoids the starting of the page outs. Too bad that it "freezes" the OS for a similar time, so it is even worse than using the virtual memory (once the memory has been paged out, the performances are not really bad).


In my case the best solution is to restart Safari once in a while. That frees both inactive and free memory. Still, I feel like going back to Windows where I reboot at least once a day just to be sure. With SL I used to leave my MB on for weeks, just closing the lit when not using it. With Lion instead it seems to degrade performances with time.

Aug 9, 2011 5:00 AM in response to jesslorenzo

jesslorenzo wrote:


Switching Safari in 32bit mode seems to be working so far. I don't get gigs of ram used up and I am left with much to spare... so far so good.


Does anyone know what are the advantages and disadvantages between running at 32bit vs. 64bit?


Thanks


In addition to addressing more RAM, it also helps with large memory mapped files... particularly those over 4GB. Having the entire file mapped into address space increases speed and performance in most circumstances. Also some programs will benefit from having the address space for 64-bit operation, while others won't. This depends entirely on the nature of their operation.


You can file Safari and other browsers under programs that don't see much benefit from 64-bit operation... at least not right now. Video Editing on the other has great potential for improvement, because of the vast amounts of data being exchanged between the RAM, CPU, and HDD.


To answer your question, switching from 32-bit to 64-bit mode should not show a noticeable improvement in performance at this time. However, the amount of RAM being used by Safari is in my opinion (and others) a bit much compared to the data size of the web sites being accessed.


I've noticed a large decrease in RAM usage by disabling Extensions as well as Java Script. Unfortunately, while disabling Extensions is a viable option as a temp fix, disabling Java Script is not considering most modern web pages use Java Script heavily. I've also noticed what I believe to be Inactive Memory being held hostage by the system, even after all Free Memory has been consumed... which is not an intended design of OS X.


The problem seems to be widespread enough, whether it be Safari, Mail, or any other programs to warrant investigation by Apple. I wish I could delve deeper into the issue, but I'm affraid I've reached the limit of my technical expertise. Hopefully we will see some acknowledgement of the issue, since this is not only a memory but for many, a peformance issue as well.

Aug 9, 2011 4:58 AM in response to Dogcow-Moof

From my first post in here you can see that 5.71Gs are being used on 2 simple tabs from Best Buy's site. Safari was not usable after I started to get a pinwheel which lasted for about 15minutes and was eating up more memory. I shut it down when it reached around 6GBs. Last night I did a clean install of Lion without upgrading from SL. Hopefully this resolves the issue.

Aug 9, 2011 5:02 AM in response to Waffl3s

Waffl3s wrote:


From my first post in here you can see that 5.71Gs are being used on 2 simple tabs from Best Buy's site. Safari was not usable after I started to get a pinwheel which lasted for about 15minutes and was eating up more memory. I shut it down when it reached around 6GBs. Last night I did a clean install of Lion without upgrading from SL. Hopefully this resolves the issue.

Let us know how the clean install goes. If it works, I might try this as a last resort.

Aug 9, 2011 5:08 AM in response to jesslorenzo

jesslorenzo wrote:


Thanks for the immediate feedback John.


Is there any performance advantage using 64bit? My MBP has 8Gig which puts me that category of having that capacity to run Safari at 64bit. However, if there are no clear or noticable advantage, I would rather keep safari at 32bit to save me the memory for other apps.

Switching to 32 bits you lose what are supposed to the the 64bits benefits:


- 64 bits CPU instructions (which are supposed to be much faster when used)

- The larger memory address space (which should be a benefit indeed and not a curse, like it appears in Safari case)



The two benefits that come now to my mind about switching Safari to 32 bits are:


- Safari can't use more than 4Gb of memory. So if you have let's say 8GB the damage of a potential memory leak should be limited

- The memory leak bug, if any, might be present only in the 64 bit version of Safari.


From what I understood Safari in SL used to manage plug-ins (like Flash..) differently depending if it was the 32 or 64 bits version. Which made them a kind of 2 different applications. Now in Lion it seems to me that Safari is just the same, with an unified code for both 32 and 64 bits architectures.


Switching to 32 bits may do some improvement as may do not. In my case it messes up Glims (latest developer release for Lion), so I decided to stick with the 64 bts version.


In any case we must rmember that this is a new release of the OS. Apple has already released to developers the upgrade 10.7.2 (do not ask me why Apple skipped 10.7.1). It is just a matter of time. Then out of curiosity yesterday I booted my backup copy of SL. Oh well.. it was very hard to go back. it looked.. Ugly!! 🙂

Aug 9, 2011 6:14 AM in response to jesslorenzo

I've the same issue.

I'm on a fresh and clean install of 10.7.

I've made becuase i've Rosetta installed under Snow, and with Lion i want a pure&clean Intel installation.


Same memory leaks on iMac 7.1 w/4Gb RAM. The system start with 2,55Gb free and after opening one or two applications or running it for a couple of hours, the system starts to paging memory: is a 0,5%-1% rate. If i close all applications, i've a 1,2Gb of inactive memory.


But...


If i switch the kernel boot to 32bit on the same hardware/installation , the system starts with 2,60Gb free and after a couple of hours using same applications (Aperture, Firefox, Mail, iTunes, Adium and so on), the page outs remains 0 and the memory free after closing all open applications rise to 2,45Gb.


So i think that is a simple and clear memory adressing and recycling bug on 64bit kernel version of Lion.

Switch applications to 32bit helps, but if you boot the system in 32bit mode, you see all the Snow speed coming back!!


IT'S A TERRIBLE FAULT, not a design implementation of 64bit.

The fact that memory could be addressed, is not a valid thing for leave 1Gb or plus of inactive memory.

Let's see with next updates of OS (10.7.2 is on the way) if the "problem" could be corrected.


Otherwise, is a very very very bad implementation of 64bit, Windows 7 has a much better memory management on 64bit version.


Ciao

Luca

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.