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

Dec 7, 2011 9:46 AM in response to AndreFromB

Yup, me as well. Safari since the latest update (which mentioned fixing memory related issues) seems to be very stable in it's memory usage, and seems to properly go DOWN in usage when tabs/windows are closed. Which is good, because I really hate Chrome's over agressive caching of content, which means it doesn't work with many webapps. =/

Jan 14, 2012 3:24 PM in response to Ruslan-RHD

Sorry, I haven't time to read this entire thread. Just to say that I've had Safari running all day, and it's now up to the following :


250MB RAM (with 16 tabs minimum, constantly open)


This is not unreasonable.


However, the Safari Web Content is up to :


almost 800MB RAM.


This seems to clearly indicate that it's the websites themselves that are responsible, not Safari.

Jan 14, 2012 3:59 PM in response to christopher rigby1

I concur with Christopher.


As I work, I often just kill Safari Web Content a couple times during the day and rarely does anything bad happen (occassionally Safari crashes, but it then autostarts up all the windows to their previous state[for the most part]).


between that and iCleanMemory, i'm pretty much taking care of my memory use under safari.


My problem is my company requires me to use firefox to read my email... which often ***** up 1.5GB of memory.

Feb 4, 2012 2:28 PM in response to christopher rigby1

There is something about the way Safari is managing web content that is different from Chrome, the other browser I use. Chrome appeared to open a new Google Chrome Renderer process when I create a new tab, but there is some other logic at play since it's not a 1:1 relationship. Those Renderer processes to fluctuate very slightly when the associated browser is not being exercised, but they do change. As I delete tabs I see these Renderer processes exit, but again, not at a 1:1 rate with the number of tabs that are open.


Right now I have 10 Safari tabs open, as I do on Chrome. You'll only see one Safari Web Process (SWP) for the browser sessions as a whole, so you might think it could be a little more efficient.


One tab to this page I'm editing and one on iCloud. As I sit and watch the Activity Monitor, I see the Safari Web Content Real Mem counter steadily clock up when the browser is just sitting there doing apparently nothing on any of the other pages that are open. Every tick of the clock, the memory footprint of the SWP increases.


To narrow it further and be more scientifically accurate, I should have identical tabs up on browers, but I don't. The Chrome Renderer processes do not seem to be systematically increasing.


Another tidbit while I'm at it. When you close the tabs from the Safari browser, that memory is not 'released' from the Safari Web Content pool. That tells me that Apple is doing doing their own memory management/garbage collection within the process, whereas Chrome is using the OS to manage the process heap. At least, that's what I'm guessing. Not sure how to 'force' Safari to clean up the SWC. I don't like killing processes to force flushes.


Chrome also has Google Chrome Worker processes that appear but notice that for the most part, these are launched up front when Chrome start and may only increase in number slightly as Renderer processes are launched nor do they decrease significantly number when tabs are closed. They may be more related to plug-ins but I haven't started reconfiguring my browser to find out. Just interesting to watch.

Mar 12, 2012 9:06 AM in response to jrperser

jrperser, my experience agrees with yours. Chrome reclaims memory when tabs are closed, apparently by killing "renderer" and "worker" processes. Safari has one process for the application and one for "Safari Web Content". The Web Content process routinely grows to 1.5GB, and only quitting the app will reclaim the memory.


I should mention that I use Safari as an communication and scheduling application. Typically, I have 2 gmail accounts, 2 G calendars, a bug tracking site, and Facebook open in Safari.


I use Chrome and Firefox when developing and debugging Web applications. This activity frequently requires restarts and hiccups, as FireBug and Chrome Inspector struggle to step through code.


I need Safari for continuous operation, so as not to miss messages. It apparently is unable to act in this role now. In the past year, Safari has exhibited another issue: it rech a state in which switching to any tab forces its page to reload. This pretty much defeats the advantages of tabbed browsing.


I have Safari 5.1.2 as of this writing.

Mar 24, 2012 11:31 PM in response to Ruslan-RHD

i think the problem is coming from Mac OS's memory manage rule.

as u can c in activity monitor, the phyical memory split to 4 parts: wired, active, inactive and free

wired is the base of kernel n applications that cannot be free unless the application quit, n free is unused memory

so, wt's active n inactive mean?

well, in my knowledge of ObjC(the standard programming language in Mac), applications can write memory by allocation

which mean when app excute "alloc 123 in to RAM" n the kernel will write 123 in to RAM(or VM) with it's own format

surely, when app finish all it's operation, 123 is a rubbish, u must delete it by delloc(or named release)

but sometimes the app call lots of libraries n frameworks out of its self

the app need to pass through a lot of value by telling the them where the value stored(the memory phyical address)

the problem is the original app dun know what is the time to delloc(delete) the value after finishing opreation

so developer always use auto release mode to alloc memory

its a memory management rule manage by kernel

when a app alloc a auto release object, developer dun need to delloc(release) it anymore

kernel will choose the best time to delloc it

so that u can c, "active" RAM is meaning amount of in-using auto-release values

oppsitely, "inactive" RAM are also auto-release values, but kernel believes that they can delloc now

n, when the system's phyical RAN is too low, kernel will sd a low memory warning to all running apps

so that it will try to delloc all inactive memory

but there's two problem cuming:

1.kernel always can define "the best time" to free up auto-release values

2.according to some reason, a small part of inactive memory wont be released until the app quit

so after a long time using, some app will eat huge of ram even u close all current file or tabs due to problem 1

n some memory cleaning software can clean a part of memory bcoz they a just simulate kernel's memory low waring

but it (feels) wont free lots of memory n u will c the app(such as safari)'s memory usage are large than it just launch

these problems a in iOS too due to they a using same mach kernel(but different arch)

but i think these problems arent just cause by the rule but the developers

developers(inculde Mac framework/kext developers) loves to use auto release

n it cause a special memory leak(maybe not leak,just waste memory)

so its not a good habit to use auto release if manual alloc n delloc can do same things

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.