Actually it's not a memory leak like the classic M$ Office leaks - it's not particularly about Safari retaining RAM after quit - it's Safari taking grandiloquent amounts of (real) RAM to do perfectly light tasks which other browsers - including past versions of Safari itself - do with reasonable amounts of RAM. For me particularly, Safari (specifically Safari Web Content) takes more RAM than I've ever seen any app take, and an unreasonable amount of it too. There is something wrong with it which could be as simple as one stupid mistake in one line of code. It's got so bad that I've now moved from my favourite browser to Opera and will stay there until a really different and fixed version of Safari is released.
What is the proper name for this bug anyway?
I don't know or care if it is a memory leak, or a "feature" to use all available RAM for caching, or an issue relating to Objective C garbage collection (if they are using it)... all I know is that after a while I wonder while my Mac Book Pro with 16 gig is running slow (and yay, it is swapping).
Activity Monitor shows SafariWebContent using 5.5gig of REAL memory.
Quiting Safari, re-opening and visiting ALL the tabs to check, and we're back down at a more modes 500 meg of REAL memory.
Whatever the root cause, Apple needs to fix it in tha appropriate way - and IMHO never trying to use as much RAM as possible for caching (which they may not be doing is not a good thing) that is what the OS level disk cache is for.
I agree about this needing to be fixed. In fact, I really wonder if Safari needs to bother with much caching at all? I've noticed it reloads a webpage each time you do a Back. Unlike Firefox for example where a Back returns you to the page in the state it was in last time you were there.
As Safari prefers to give you the latest version of every web page you go to (EVEN when you do a Reopen All Windows from Previous Session), it makes you wonder why on earth Safari has a cache at all. They could do away with it, cure this problem, and not affect its behaviour.
Still not fixed in 5.1.5 at least not in 64bit mode.
I've got only 2GB of RAM so I'm killing the "Safari Web Content" every now and then,
This Safari backend is crashing on its own without any error message, just the all-tab-reload pain,
it will hog the memory even when reloading the same page again and again, for instance reloading this very page without being logged in will bump up the memory usage by .5 MB every 10 reloads.
So there is definitely a memory leak, I shall try the 32bit mode then.
End of May 2012 now - Safari Version 5.1.7 with Lion, 8GB RAM, IMAC.
I'm starting to use "activity monitor" more for monitoring & sometimes imporoving all the memory-eating and occasional hanging with Safari tabs &/or entire windows. Maybe "I'm asking for trouble" but when I work on projects, I often have 3 or 4 instances of Safari open, some with maybe a dozen tabs, one or two with up to 100 or so. Some with video or photo displays, some with forms, but nothing overtly playing or launching as I focus on one or two tabs in back to back browser windows (27" iMac display, G-d bless).
So now I'm finding - really only recently - more and more "gunking up" that doesn't resolve with a restart or PRAM reset even. Once a few browser windows with the tab collection I'm using are back up, all is well for hours or days, and then... freeze city. Here's when I started observing how using Activity monitor can sometimes find a "dead tab" spinning away which I can close and watch RAM get freed up. OK, that's my situation, similar to others I've read.
I tried deleting the .plist for Safari (in library) as suggested. Neither helped nor hurt. Next step: having saved and bookmarked crucial bits I'm working on, I took a deep breath and simply deleted Safari Web Content. Only moments before it was showing well over 100% CPU hogging and 75 thread, and lots of "real memory". The main Safari process was in red, now basically frozen even as I delete some tabs. Now - after deleting Safari Web Content (the open process), I have a very nice surprise: Nothing bad happened to all the open tabs - the currently used "Safari Web Content" has not disappeared. All my windows and tabs are open and "live" - nothing lost anywhere, and.... ta-dah! Suddenly "Safari Web Content" is very well-behaved and so is Safari. Activity monitor shows Safari Web Contet is back, but at 2.5% of CPU (down to .4% as I type), with 11 threads and using 358 MB "real memory". Safari itself, with all the (4) windows open and maybe 200 tabs or so, is now drawing .2 to 1.2 % of CPU as I'm watching and typing, with 12 threads and 186.9 MB "Real memory" use. "Free: 6.0 GB". (out of 8) .
Not bad! So whatever the causes (and it's not just using lots of windows, as I can attest) - whether a "leak" or some function of how RAM is used/released with a journaling system like Mac's, or just one of life's mysteries -
I did my little "scientific test" at last and seem to have found a very easy, harmless, solution in simply deleting the "web content" process through the activity monitor. It immediately creates a new one, and everytyhing is suddenly 'like new" with tons of RAM and CPU space to spare, even with so much Safari content actively displayed.
Thanks to all. Lots of good references and tools and importantly, I know this is not an imaginary problem! Seems pretty common - still. Well, maybe this will work for you, too. No rebooting, new software, or anything else required. So it seems so far. (Fingers crossed.) If in doubt, of course, save/backup. But for me, this worked!
We felt there was a memory leek because as you use safari the "Safari Content Manager" keeps explicitly utilizing more and more memory regardless of weather or not you "have" 20 tabs open or "had" 20 tabs open 2 hours ago. Personally I would assume that once you have closed a tab or navigated to a different web page that Safari would free up memory as necessary. To hold on to that memory after it is no longer necessary seems strange to me.
To be completely honest i have no idea if this is still an issue as i've sidestepped apples releases of safari in favor of downloading and running webket directly.
drmikenyc gave me the courage to try quiting the safari web contect process in the activity monitor.
I did so while I had this page open. When I quit the process, this page immediately reloaded. Then when I clicked on my other open tabs, each one reloaded as I clicked them. No other problems. Safari Web Content reduced but has started creeping up again. Just about equal with the Safari process "real memory" amount after only about five minutes. Five tabs open.
I would occasionally be forced to restart Safari Web Content process beacause Safari itself would freeze but that seems to be the only "solution" given. But just like ipeel said, after just a few minutes it was just as bad as before.
I bought an extra 2GB of ram to hopefully carry some of the extra weight from Safari but you know what happened? Safari went from averaging 800MB (minimum) to now using 1.5GB (minimum) and I began having the same issues with slow speeds, crashing, and an obscene about of ram and even CPU being used.
I have tried to find somewhere, anywhere on Apples website to email tech support or anyone associated with Safari and there is nothing. This amount of memory usage that many are getting is not ok, especially from one of the leading computer software companies in the world.
Alas, I am deeply saddened to say that I must say goodbye to Safari unless an actual solution is delivered or even addressed. Since I've switched to Chrome I now have nearly 1.5GB free even with Photoshop taking 1GB.
The fix for me was to stop using Extensions. Once I uninstalled all extensions and turned off the Extensions completely the issue went away. My Safari Web Content hangs between 200-300MB and never goes up. I use Safari exclusively all day running anywhere from three to ten tabs at once with no issue. If you are running extensions, trying uninstalling and disable the feature to see if the issue continues for you.
After my first And last post on this thread, I've quit using Safari except for viewing some sites that Camino has problems rendering Flash on. Using Camino and Opera mostly.
What surprises me is that this is an Apple support forum and I haven't seen one Apple employee address this ongoing issue.
I read, somewhere, that one of Camino's founders, was hired away to the Safari team by Apple.
Camino has it's faults, but I just wonder what that person did so well that he was hired by Apple to work on Safari? It sure wasn't to address their memory problem, since it's always been terrible; since 2003 anyway.
Memory is not a problem with Camino or Opera, in my experience.
Killing Web Content works temporarily, but what a way to have to use a browser.
Safari handles, or better put, mishandles cookies and their deletion worse than any browser I've used. That's another story, but in my naivete of making programs and applications or writing code, I sometimes wonder if these things aren't somehow related, since I can't keep deleted cookies deleted in Safari. Sometimes they come back immediately after deleting them. Sometimes they All (sites I haven't visited for days and deleted their cookies then) come back after a restart of Safari.
I'll have to put Safari on a friend's Windows machine and see how it works there.
In my Macbook Pro 4GB RAM recently note memory leak when I opened Safari even with 1 or two windows open without refresh the web content.
In Activity monitor could see consume Web Content the Safari Spend more the 2 GB RAM (Memory Inactive)
Solution: Disable All Extensions and probe one to one. Finding that Fastesttube Extension was responsible.
Check this Info
This issue only gets worse. I typically observe Safari using 6GB or RAM, over and over and over, making both my iMac and Macbook essentially unusable, multiple times a day, at the most crticial times. Where is Apple on this? To have the key application on their desktop platform essentially cripple one's ability to use their devices, and for this conditoin to persist for so long, is nearly unimagineable, but none-the-less, it persists.