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

Massive Mountain Lion memory leak

I will start describing the problem where I first discovered it.


My early 2011 MBP had been asleep, and upon opening and waking it, it was incredibly slow. I opened activity monitor and couldn't believe my eyes.


I have 8 GB of RAM, and all but 8 mb was in use. Around 6 GB was "inactive". I had no applications running besides Activity Monitor.


I opened terminal and ran the purge command After a short wait, total memory usage was back to around 2 GB. Then right before my eyes, over approximately 30 seconds, the "inactive" memory grew until once again, I had about 8 mb of RAM free. This fluctuated a few mb, but nothing significant.


After rebooting, I opened Activity monitor again, to watch ram usage. Usage increased to a little more than 2 GB. I then launched the App Store. Before putting my laptop to sleep earlier, I had been downloading a 10 GB update to Borderlands, but had paused the download, and quit the application before closing the laptop. I hit resume download, and went back to Activity Monitor. Memory usage seemed normal for several seconds, but shortly started increasing rapidly again. I imediately hit "pause download" in the App Store. But ram usage continued rising, so I quit the application. It kept rising, until my full 8 GB was in use.


At this point I took a screenshot:

User uploaded file


The only thing I have left to tell you is that before upgrading to ML, I had previously attempted to download the same update, but hadn't had time to download the full 10 GB, so had cancelled the update. That was in Lion 10.7.4, with 4 GB of RAM, and I had no issues.

MacBook Pro, OS X Mountain Lion (10.8.2)

Posted on Sep 26, 2012 6:17 PM

Reply
Question marked as Best reply

Posted on Sep 26, 2012 6:53 PM

Your screenshot shows nothing abnormal. Having a lot of inactive memory simply means that it's been used and released. If you're curious as to what was using it, you'll have to look at All Processes, not My Processes.

120 replies

Sep 27, 2012 2:29 AM in response to Linc Davis

Inactive memory is memory that hasn't been released, and is therefore unusable by any other programs or the operating system. If the process the the memory was allocated for is no longer running, then it is, by definition, a memory leak.


Besides which, my computer was running at a snails pace at that point. Taking a screenshot took around 10 seconds before the file appeared. And constant pinwheels. Even trying to bring up the shutdown dialog took ages.


If a completely disfunctional computer isn't abnormal, I don't know what is.

Sep 27, 2012 3:05 AM in response to LousyFool

I appologize for my hasty and know-it-all-esque response before checking my facts.


However, I do know that when that inactive segment filled the pie, my system was dead in the water. When I did a purge, it ran smoothly again, until in a matter of seconds, my inactive memory was full.


I don't know why that would be since, as Linc Davis said, its been released.

Sep 27, 2012 3:17 AM in response to imclerran

Thank you very much, apology greatly appreciated, and readily accepted.


You'll have to admit that it sounds like the perfect oxymoron when you state on one hand

...it was incredibly slow.

and

Besides which, my computer was running at a snails pace at that point.


and on the other hand

I had no applications running besides Activity Monitor.


Hmmm, nothing running, how do you know it's slow then, anyway?


Whatever, the last thing I worry with OS X is memory management - it's famous for its clever dealing with my Macs' grey cells, and that in mind I couldn't sleep better - since many years.

Sep 27, 2012 3:26 AM in response to LousyFool

Agreed, I have always appreciated OS X's clever memory management algorithms.


As I stated in my more regretable post, my screen shot took around 10 seconds to post, as opposed to the usual split second. Clicking on anything in activity monitor brought up a pinwheel, as did clicking on anything in the menu bar. Clicking the apple Icon to attempt a restart resulted in waiting for the pinwheel about a minute.

Sep 27, 2012 6:38 AM in response to imclerran

Inactive memory is frequently used as an I/O cache. While I do not know for sure, I think that a lot of the inactive memory may have data that still needs to be synced back to disk (as in disk writes that are cached, and still need to be written to disk). When other processes need RAM, and inactive memory is used to satisfy the need, the app may nave to wait for slow disk I/O flushing inactive pages before the inactive memory can be given to the requesting app.


Again, I do not know for a fact that Mac OS X keeps cached writes in inactive memory for extended periods of time, however, the slow performance when needing RAM and inactive is all that is available, and considering that laptops consume a lot of power keeping the rotating disk drive spinning, and there are some tasks that update logs on a regular bases that would tend to force a laptop to keep writting to disk, it seems to me that maybe Mac OS X addressed this situation by deferring writes to disk, and using inactive memory to cache it.


The purge command seems to forces Mac OS X to move pages from inactive memory to the free list, and in doing that it would need to flush cached writes to disk, which is why it could take a long time for a purge to complete.


All speculation on my part.


As to Activity Monitor being your ONLY running process, you need to look at ALL PROCESSES in Activity Monitor, as Mac OS X ALWAYS has dozens of background apps running, and if one of them is running away doing lots of I/O, or maybe you have a backup running which will also do lots of I/O, all of which will tend to fill the inactive memory with cached I/O buffers, this could be the source of your growing inactive memory.

Sep 27, 2012 3:47 PM in response to BobHarris

So what I'm understanding is that even though I quit the App Store application, there could still be a backend process or service that was sucking up my RAM. Makes sense, I'll check that in future.


Your theory as to why inactive memory was slowing down my system so much certainly makes sense.
The purge command itself actually didn't take much longer than usuall, although it should be noted that it usually takes several seconds. It did initially it take me a while to issue the command, but after it completed, the inactive memory filled back up, and the system was once again unresponsive.


I can also state that the problem appears to have been caused by a corrupted app store temporary download file. (I had forgotten to pause the download before closing the laptop) After a lot of fiddling I was finally able to get the app store to start the download over, and this time the problem didn't occur.


P.S. Thank you for taking my admittedly strange problem at face value, and not questioning whether a problem actually occurred.

Oct 2, 2012 11:25 AM in response to imclerran

I understand what is being said, but I notice that on my Mac Pro with 20gb of ram, if I start the computer, let it just sit there with only the apps that it uses at startup, come back 2 or 3 hours later and open activity manager, there are times when there has been 8 or 9 gb in inactive memory without ever opening an application. All i have running on startup (aside from the OS) is Itunes helper, and Dragthing. What is using that 8 or 9 gb of ram?

Oct 2, 2012 11:31 AM in response to WillytheKidd

Do you have automatic backups (TimeMachine, SuperDuper or Carbon Copy Cloner, etc... as a schedule regular backup)?


The Inactive memory is used as a cache for program pages and I/O data. The more the operating system can cashe the less it has to use that old slow clunky rotating disk drive, and the faster Mac OS X can respond to your I/O needs (or that is what it is trying to do).


Also you have background daemons, so you my have been doing network I/O, such as Software Update checking standard program versions to see if there are any new updates that apply to your system.


There could be any number of background activities going on that would be doing I/O when you are not sitting in front of your Mac.

Oct 2, 2012 1:00 PM in response to BobHarris

Thank you for the response. I guess what is odd to me is that this did not happen under Snow Leopard. I have had this happen when I do a safe boot when only the plain OS is supposed to load. (right) If I am using the machine, I have never had more than 1 or 2 gb in the inactive area. I am just supprised at the amount of ram going to inactive when to me (as far as I know) I am not using any programs which would cause that amount of ram to be cached.

Oct 2, 2012 2:14 PM in response to imclerran

I think I was able to nail it down as I have the same issue. I'm running an iMac that was sold with Snow Leopard and I've updated to Lion then Mountain Lion. I noticed the memory leak after a week of my upgrade. After lots of searching and trials, I noticed that if I use Safari to search the web, the inactive memory starts to grow. And by looking into the activity, it looks like flash applications like facebook causes the problem to exploit. I noticed later that I had an extension running under Safari which is "FastTube" to download from youtube.


It seems that FastTube causes some memory leaks through the flash application. So, I deleted FastTube and since then, my iMac is back on trac.

Nov 10, 2012 1:35 PM in response to YagoDR

Do you have a problem, or do you just not like lots of Inactive RAM?


If you do have a problem (performance, or some app will not run, etc...), then start a new thread so you are in control of that thread and can mark it Answered when you feel you have found a solution.


In an earlier post to this thread, I explained that Inactive can be filled from things like backup (TimeMachine, or your own), it can also contain previous run programs that are waiting to be relaunched.


Inactive RAM is RAM that has known information it, for quick reuse, but can also be given up an application needs RAM for code or data that is not already part of Inactive RAM.

Nov 10, 2012 1:50 PM in response to BobHarris

Sorry for being in the wrong thread. I do feel underperformance and lack of speed with no Free RAM in many cases. Perhaps you can answer a couple of doubts even though it's the wrong thread... :


Do you know if purging the RAM when I feel the underperformance can be unhealthy for the system? Sometimes I purge and a whole chunk frees up but in a matter of seconds the Inactive RAM builds up again, with no apps running and without quitting anything....just frees up and then drains down again. I've read about some scripts that'll purge the RAM if inactive memory build beyond a certain threshold or if Free Ram falls below a ertain threshold... any tips on that? Or is this behaviour perfectly normal in ML and I should simply forget about it? It's basically the fact that I have plenty of RAM but feel underperformance when I trust I shouldn't that bugs me..


Thanks and sorry again

Massive Mountain Lion memory leak

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