Memory leak while surfing Safari

When you just opened Safari (5.0.3 (6533.19.4)) then requires 30-31 MB RAM from OS system (10.6.6 10J567).

User uploaded file

But eventually Safari takes more and more memory.

After one hour active surfing Safari is take on over 380 MB RAM.

User uploaded file

And after closed all window and tab memory size almost not decrease.
Memory is not freed and not returns to system.

Finally, if you do not restart Safari, it slowed, and then crash.

Tested on 2 - iMac (24 and 27), 1 - MacBook Pro 15, 3 - MacPro.


+P.S. Sorry for my english!+

iMac, Mac OS X (10.6.6), Intel Core 2 Duo

Posted on Feb 12, 2011 12:05 PM

Reply
54 replies

Jun 23, 2011 8:24 AM in response to eeyoredragon

I took your advice and using Secrets turned off or reduced various settings. I have three extensions (Clip to DevonThink, HoverZoom, and BackTrack). Sadly, I'm still seeing huge memory seizures whenever I have multiple tabs open (I'm talking about four or five). Right now I'm at 1.7 GB and rising. Is there a way to identify what the offending process is? e.g., Flash?

Jun 23, 2011 8:34 AM in response to eeyoredragon

I've updated to the changes mentioned here and it helped a bit.


But what I noticed was


adblock the extension was the major culprit. removing this removed a major memory leak, and some performance problems.


Also noted that print plus extension also caused a lot of performance problems.


So I would recommend you review all your extensions and if you don't need it, remove it.


Now I can run sunspider, and keep my memory below 200mb and it finishes in seconds.

Aug 11, 2011 7:08 AM in response to Ruslan-RHD

I've reported this problem as well. Its been going on for years. It was hard to figure out that the problem was Safari. They still haven't fixed it.


I gave up and switched to Chrome. But now I'm running Lion. I wanted to see the new behavior in Safari. So I've been running it the last week or two.


Yesterday, noticed by system was acting slow and unresponsive. I checked and Safari was using up almost 2GB of real memory. My swap file, that normally isn't used much, had ballooned to 3GB. I closed Safari and all the memory was freed up. Closing all the Safari windows did not free up the memory.


I've struggled for a long time to figure out if its an extension or pluggin. But as far as I can tell, if I run a vanilla Safari with no extensions, it still acts this way. It can take days to build up to consuming this much memory.


Chrome does not have this problem. No matter how much memory it takes, when I close down windows, the memory is released.


I'll have to give up on Safari again. I don't see how anyone can use it when it cripples your system sooner or later.

Aug 11, 2011 7:27 AM in response to brsw

I've noted that they all leak. I think it's javascript and/or flash (chrome), as the more 'interactive' sites tend to drive use up.


There is an app in the appstore, iCleanMemory, that will effectively 'garbage collect' memory pages (yeah, it's not garbage collection, but it does what I want it to do, which is 'cleanup the trash pages'), and it typically trims memory use back down


Works with 10.6.* and 10.7. Crude interface, but it works. (when cleaning, it's stalls out your programs, so it's not cleaning continuously... you put the 'optimize memory' button, and it starts it's work... other wise it just shows free memory every second.).


I have safari and chrome open now, and a few other apps, and before cleaning memory I have 336mB free on my 4GB mini. click... wait 5 seconds, and I have 531mB free. I've seen memory go down to 8mB free, and have it free up 1000mB in 20 seconds.


To really clean up, you do have to quit Safari and/or chrome occasionally, but if you churn a lot of pages, this helps in the interim.

Aug 11, 2011 8:21 AM in response to NextCubeUser

Wow, what a difference running sunspider.


Chrome 13.0.782.109 beta. Ran very very quickly. Chrome using 94MB real memory after test.

Safari 5.1 (7534.48.3) took minutes, maxing out CPU, grindingly slow.Safari using up 643MB after one run! All I've done is start it fresh, and run sunspider on Lion, 10.7. Kept going up on second run.


I turned off all extensions and it ran lightning fast, faster than Chrome, orders of magnitude faster than before. Memory usage only 84MB.


The only extensions I have are 1Password, and Click2Flash.


Turning them on one by one, looks like enabling either one slows it down terribly and starts consuming memory.


Is the extension mechanism broken in Safari? I have extensions installed on Chrome with no apparent bad effect including 1Password and an equivalent to click2flash.

Aug 11, 2011 1:26 PM in response to brsw

Click-to-Flash is the only extension I use, and my memory usage has been enormous, 5GB+ at times! However, if I don't use this extension, memory use is the same or more due to all the flash use, especially if I start up, and many tabs had videos or streaming audio! I'm hit with a cacophony of all of them playing at once! Thus my use of Click-to-Flash, and my "between a rock & a hard place" situation remains. I sure wish Apple would just fix this mess.....

Aug 15, 2011 4:41 PM in response to Saxman

There are so many threads about Safari issues. Those involving memeory leaks, spinning beachballs, reloading tab pages, etc. I've had various issues since upgrading to Lion and most seem to be related to Safari. I've seen posts about uninstalling or disabling extensions and plugins and seen posts about downloading and using such items to deal with the issues. I have to wonder if we're all chasing our tails here. I have three plugins installed, 1Password, AdBlock, and Click to Flash. I really don't see why those extensions would have any negative impact, two of them should actually help with certain issues. I am playing around with disabling these but whether that's improved things I don't know. Just about anything you do seems to help for a while until it doesn't. It just seems like the issue is Safari and until Apple releases an update I don't think any "solution" is going to be the answer. Hopefully we're all going to the feedback page and listing these issues and maybe leaving links back to these threads.

Aug 15, 2011 6:43 PM in response to Pappasbike

Well, I discovered on the ClickToFlash website that their extension is NOT compatible with 5.1. So I removed that, & instead installed "ClicktoPlugIn". After doing that, I see Safari isn't using quite as much memory, only a couple gigs, instead of four or even five. However, it still runs up the CPU usage as high as 190%, and still stalls out, & usually won't even close on it's own, without being forced quit! I realize now, that only one of the two higher level tech guys I spoke with was being straight with me, the one who told me they were aware of Safari being buggy, and that they would release a fix ASAP (of course this was nearly three weeks ago). The second one gave me the same old, "I've not heard anyone encountering problems with it, it must be your installed plug-ins & extensions", etc, etc., And you would think, if all these problems were due to something as simple as certain plug-ins &/or extensions, that Apple would just release a list of which ones to get rid of! It's not rocket science, but it sure would be good for customer relations. Too bad Apple's been slipping in that department for a number of years now.....

As for Firefox & Chrome, they have not been the most consistent performers either, and Chrome, in particular, has some maddeningly frustrating quirks, that make for a less than smooth experience. I like Safari, feel comfortable using it, and was really happy with the previous version, 1.05. But then they went & attempted to "fix" what wasn't hardly broken, and only made it far, far worse! If I were typing this on Safari, it would take me about 5 times as long, while I waited for the spinnig balls to stop after every sentence,.... or less!

Aug 23, 2011 2:29 AM in response to Ruslan-RHD

Ok, thanks to sunspider, I figured out that the memory leaks comes from extensions. Not about any particular extension (I only use 1Password one) but to the extensions management. When you turn off the extensions via the slider, Safari is as speed as it used to be few years ago 😀


Let's hope apple will review the extensions management and figure why they interferes with memory issues.

Dec 7, 2011 2:53 AM in response to Ruslan-RHD

Finally ...

Apple manged it to resolve this very annoying issue.

The latest Safari update seems to have resolved it ... at least for me.

Safari Version 5.1.2 (6534.52.7), MacOSX 10.6.8 (Snow Leopard)


The Safari Flashback plugin vanishes as soon it's not needed anymore, memory usage of Safari itself remains pretty much constant at a low level (below 100M) just Safari Web Content increases slightly, but usually stabilizes below ~350M. It's even possible to kill Safari Web Content without Safari itself going down, which helps to keep the memory consumption significantly lower.


I can't remember that I had more than 1G free memory (of 4G) ... after more than a day after a Safari restart ... 🙂


A nice side effect:

the machine is much more silent (due to much less paging) -> less energy, better for everyone 🙂

Dec 7, 2011 9:21 AM in response to Ruslan-RHD

I have the latest version of Lion and Safari and have definitely been seeing my Available memory sucked up by safari. I downloaded a memory utility from the app store to release memory and that has helped. After the latest safari update I was hopeful that this issue would be resolve... It definitely wasn't! I switched to Chrome and am no longer having memory issues. I guess I'm through with Safari on my Mac. :-/

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Memory leak while surfing Safari

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