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

Dec 17, 2012 5:49 AM in response to fiddler64

Folks, I've been asked to be a bit more specific regarding this issue...


I can't speak for everyone suffering from this issue but maybe there's something in here that can help you, of course this information based upon my opinion (For whatever that's worth),


There have been several Java releases recently that are buggy and have some big vulnerabilities, specifically with some recent Java base code and SDK's. All software sub-branches are therefore affected, including JRE, JSE, Java plugins (Javascript) and dependant frameworks. I've included a link in an earlier post that's a good starting point for those who are interested in more info on this subject. Lion was initially packaged with one of the affected Java releases.


The main symptom of a system getting hammered with a Java issue is a runaway sub-process of a program that uses Java functions. Safari, Firefox, mail, etc.. This results in the sub-process "maxing" out both the memory and CPU utilization. You can kill the sub-process to stop the runaway train but the problem will reoccur once you try to browse again. Also the runaway process will occur when browsing "Healthy sites" as well as broken sites. So it's not necessarily related to poor site programming.


When we ran into this problem we first just turned off Javascript in the affected browsers, this did solve the problem but.. may sites require Javascript so that wasn't a good solution (There is a solid argument for turning off Java altogether, but that's a topic for a different thread). We switched to Chrome on the affected systems which apparently used a different Java base for the plugin and that seemed to solve the problem.


Another suggestion is to be sure that you are using the latest update for Java, On lion this would be 1.6.0_37 or later. You can check your java version by using the "java -version" from the command line.


see http://support.apple.com/kb/HT4883


Of course it goes without saying that you should absolutely have the latest software update.


I'm not aware if this problem affecting Mountain Lion... Holler at me if anyone using 10.8 seems to have this problem.


Another issue with Lion is that many app's seem to lose track of memory (Blue pie). This doesn't seem to be a kernel issue but maybe there's a bad Lib out here somewhere that's causing the memory problem. I just use the "purge" command often and this helps me deal with that issue.


Hope this can be of help to someone.

Dec 17, 2012 7:02 AM in response to kyle321

The comments on the CPU came around because JeepRuby had a Safari that was pegging one of his CPUs. So when that happens it can often appear like you are quitting Safari but you're really not.


There are several possible explanations for this, but the only thing I am sure of is kyle321 explanations are wrong. It seems petty to say, but his recent long message is full of a lot of misinformation and I feel bad. If I knew there were a way to contact individuals on this site, which apparently some people have done with him, I would have tried to hash this out with him privately in case there's something new for me to learn.


For example, purge is a way to free up RAM that is holding freeable file system cache according to the man page (and my experience):


purge -- force disk cache to be purged (flushed and emptied)


Therefore, if your app is consuming a lot of memory, as was the case with JeepRuby's Safari, purge will have no effect. It will free up disk cache memory but not any memory from an individual process.


Second, there is no relation between Java and JavaScript. JavaScript, in Safari, is implemented in Objective-C and there is no Java interpreter involved, period. I just looked at the source code of the project to be super-doubley sure. And the Mail program also does not run a Java interpreter. It displays html email messages, which means it runs the same HTML rendering engine as Safari, but I am pretty it does not allow JavaScript to be run because that is just asking for trouble, e.g., every SPAM email could continue running JS code, wreaking havoc effortlessly.


The exploit mentioned in one of kyle321's comments means that the perpetrator can run native, arbitrary code on your computer, according to the web page that he sent out. That means it can take over your computer and do anything, and typically what they choose to do is NOT enter an infinite loop in your browser. Typically it will download some files, start a server, and wait for instructions.


Meanwhile, one of Apple's updates in mid 2012 disabled the Java plugin in all browsers, because of the axploits mentioned in kyle's links, so unless you explicitely turned Java plugin back on, it's not even an issue:


http://hints.macworld.com/article.php?story=20121024002012496


Again, Java is not Javascript. You can disable or enable JavaScript with your Safari settings. To re-enable the Java plugin, you need to follow these instructions. I for one have not felt the need to re-enable it, and in fact I had already disabled it after all the press:


http://support.apple.com/kb/HT5559


"I know nothing, Jon Snow" but I am pretty sure of the facts of this message. If kyle knows how to contact individuals, please send me a message so I can learn the error of my ways. I don't mind being wrong. I just can't stand it when people are having trouble with their computers.

Dec 17, 2012 7:48 AM in response to fiddler64

Jonathan, as I've said before, I'm not trying to be argumentative here and wasting time on dueling credentials, is just not something I wish to do. I'm sorry that I've ruffled your feathers, that's not something I wished to happen.


My feelings are that any guidance to the readers could in someway be helpful and believe that's the spirit of blogs such as this. The only reason I posted in is because I thought this problem was solved long ago and this blog was obsolete, I just noticed quite a bit of recent activity on this blog and thought I might jump in.


I feel that I've provided some real direction regarding this issue, there's plenty of information out there regarding this problem. All you need to do is look for it.


As far as off-line contact goes, you can't contact folks directly unless you know them personally.


I know from personal experience how frustrating this issue can be. I hope my posts can be of help to someone, that's all. - Good luck


Cheers Mate!

Dec 27, 2012 11:07 PM in response to mightymilk

I thought it was just me.. I hate the memory management here, I upgraded my RAM from 4 to 8 to 16 but freaking inactive memory situation still remain. at one time i had 12 GB in inactive memory,If i launched something at that point, it's extrememe pain to use it.. running purge command is not a solution.. freeing up that memory is... I wish i could upgraded to 32GB & test it but i think the problem would still be there....

Dec 28, 2012 6:57 AM in response to Bobdc6

Moving things in and out of memory becomes fast enough with an SSD that free memory doesn't seem to matter in practical terms.


We're bumping up against the way Mac OS X handles memory allocation. It seems to have gotten worse with Lion and Mountain Lion.


In my case, once I got rid of some run away processes, things are fairly stable. Free memory still gets used up. I'm currently stting with 90mb of free memory and 3.9GB of inactive memory. However everything runs fine until I launch another app or do something with an inactive app where free memory is needed. At that point I may see spinning beach balls. I've also see the spinnning solver disc. If things get too slow, I use FreeMemory Pro and free the inactive memory. I rarely need to do that more than once every few days. And I reboot from time to time just to clean everything up.


But all in all, it's infinitely better than Windows XP was.


As always, I may not know what I'm talking about and your mileage may vary.

Dec 29, 2012 8:08 AM in response to bobbd

I've noticed a little lag in loading apps with 19mb of free ram and several apps already open, but once open, they operate normally. Also, I noticed the beachball at times when scrolling, so I have decided to max out my ram from 1GB to 4 GB. There is no reason for me to do this other than wanting to NEVER see the beachball, and it's kind of a challange to see how long my 2007 MacBook can operate in the ever changing enviorment of bigger memory eating apps. I'm really happy with my new SSD, it's like having a new laptop.

Dec 29, 2012 12:55 PM in response to Bobdc6

I had to reboot after three days of operation as free ram approached 12mb. Hesitation approached several seconds after clicking or opening an app. I was curious if I needed ANY free ram with a SSD, well, I do, but with free ram above 20mb, my MacBook seems to work ok, which is spectacular since with my HDD, free ram needed to be 1GB or more for relalible operation. I'm learning a lot here.

Dec 30, 2012 1:05 PM in response to kyle321

Hi, Kyle. FYI, although they share some similarity in name, Java and javascript are two distinct languages. Java is an interpreted language that uses a virtual (software) machine called the JVM to translate Java into code that is understandable by the machine on which it is running.


Javascript is a scripting language used to write code that enables web pages to be more responsive to users. Drop down menus, for instance, on web pages-- menus that drop down when you pass the cursor over them-- and similar animations are written in javascript.


Microsoft's version of the language is a bit different, and they call it Jscript.


Thus you may think of Java and javascript as quite separate entities. Recently there was a security problem with Java, so it's always a good idea to either disable it in your browser (preferences), or if you need it to allow you to run java applets within the browser, make certain that you keep it updated to the most recent version available. You can update at oracle.com.


Hope this helps to clarify the situation a bit.

Jan 8, 2013 8:29 AM in response to Bobdc6

I have a question for you guys.


How many of you see this problem after waking up from sleep?


I have noticed that everytime I wake up my machine from over night sleep swap increases. If I reboot and work on it using the same software and usage pattern and do not put my machine to sleep it never swaps. Also Mission Control slows down when swap increases. I worked with apple Eng Team to resolve this. I was told that this case will be fixed in next point release. No ETA was provided.


So my question is. How many of you see this problem when your machine goes to sleep?

Can you disable sleep for some time and report here if this has changed? I mean deep sleep (lid closed on my MBP).

Jan 8, 2013 8:43 AM in response to OxOOCOFFEE

I wonder if this is related to the


Enable Power Nap


option in Energy Saver.


That allows time machine backups to continue while sleeping, along with things like fetching email, updating calendars, etc. It's kinda nice because I do see my email already downloaded when I turn on my computer in the morning. But those time machine backups are probably not all that important to me.


However, Time Machine backups are related to this problem, as far as I can tell, because crawling the file system to perform a backup often touches a lot of files, and those files are loaded into the file cache and become 'Inactive memory'. (I realize time machine doesn't crawl the entire file system in the normal course of events, although when it is deleting an old backup, I do wonder what happens then.) I feel that the change from Snow Leopard (flawless in a lot of ways) to Lion was that the file cache was taking precedence over application memory. Seemed like a very bad change to me, unless you have an SSD, in which case it appears not to matter (and that makes sense to be honest).


Anyway - maybe you could turn off Power Nap mode and see if that helps with the over-night situation.


Also - do not forget to quit Safari from time to time. It leaks memory and struggles to give it back to the OS, even if you close all the windows. And remember that closing all the windows is not the same as quitting an application: the former closes the windows, the latter quits the app and returns ALL the apps memory to the system for other apps to use.

Jan 8, 2013 9:01 AM in response to Jonathan Payne1

I did try to turn of power nap. And no change. For each change I give couple of days to see what changed.

As far as Safari goes yes I do shut it off once a while. I collected a LOT of data for apple. I have full trust that Apple Eng departament will get this corrected. 😉.

I do not use Time Machine (it is turned off and never use it). If I do not put my machine to sleep at all for few days there is no swap/slowdown problem. And again Power Nap it does not changes anything. Still it could be a problem in some way but I will leave it to Eng. I have full plate of coding myself....

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.