Menu Content/Inhalt
Home arrow Computers arrow Development arrow Safari's a Memory Pig

Online

No Users Online

Login

Syndicate

feed image
Safari's a Memory Pig PDF Print E-mail
Written by Dave Thorup   
Monday, 26 June 2006
An expose of one of my two screens.
An expose of one of my two screens.
OK, to start this off I must admit that I'm a Screen Rat - the digital version of a Pack Rat.  I keep tons of applications open at once with literally dozens and dozens of windows open (I just counted and I have 26 applications and almost a hundred windows open right now, and that's after I just quit Safari).  But with 5.5 GB of RAM I can afford to have everything open at once.  Safari though, like no other application, just seems to gobble up RAM like a goat in a petting zoo (watch out for those fingers kids).

The first rule of being a Screen Rat is to never quit an application, NEVER!  You should only quit an application when you need to shutdown your computer, there's no other excuse.  Well, that is unless that application is Safari.  For some reason if you keep Safari running for a few days its memory footprint will just keep increasing.  Sure, it'll start off using a nice cool 20-30 MB, but after a few days of browsing and countless windows open it will balloon to 1.3 GB.  1.3 GB of RAM!  For a web browser!  That's actual RAM in use, not the virtual address space, the virtual address space is well over 2 GB. 

Normally what you do when an application starts hogging RAM is release some of its resources.  In this case, you start closing those dozens of windows that you've opened over the last few days.  That would be enough for most apps, but not Safari.  No, just now I closed all but one window in Safari and the RAM usage went from 1.3 GB to 1.2 GB - 100 MB.  Sure 100 MB is a good chunk of RAM, but it's only about 8% of what Safari was using.  How could the last remaining window be using 1.2 GB of RAM?

Anyway, at that point I was fed up, I'd need to quit Safari to reclaim my RAM.  I repeat this cycle every few days and the only solution I've found is to quit Safari.  I've tried emptying the cache, closing all the windows, clearing the history and using the Debug menu to empty all of the caches (WebFoundation, WebCore, JavaScript, etc.).  Nothing works.  Once Safari has ballooned into a memory gobbling behemoth there's no way to reclaim the memory short of quitting the application.  This is utterly depressing for us Screen Rats. Maybe I'll have to try using Camino or Firefox instead to see how well they behave.  I do use them both often, but not nearly as much and as long as I use Safari.  They seem fairly well behaved right now, but I wonder how well they hold up after a week of continuous use and dozens of windows opened.  Can any fellow Screen Rats comment?
 


Related Items:


Add as favourites (90) | Quote this article on your site | Views: 4345

Comments (7)
RSS comments
1. 28-02-2007 20:14
 
How are you measuring RAM usage?
Guest
 
This e-mail address is being protected from spam bots, you need JavaScript enabled to view it
2. 28-02-2007 21:08
 
In the Activity Monitor with Real & Virtual Memory usage. As well as in top - RSIZE and VSIZE.
Registered
 
This e-mail address is being protected from spam bots, you need JavaScript enabled to view it
3. 28-02-2007 21:15
 
And which of those figures are you referring to when you say the RAM usage went from 1.3 GB to 1.2 GB?
Guest
 
This e-mail address is being protected from spam bots, you need JavaScript enabled to view it
4. 28-02-2007 21:30
 
That was real memory usage. I don't remember what the impact was on virtual memory. 
 
Note that this was June of last year when I made this post and I haven't seen Safari behave quite as badly as this since. Though I do still tend to get up into the 700-800 MB (real) range and > 1.5 GB virtual and closing all open windows only releases a fraction of that RAM. It's hard to say how to easily reproduce it other than to keep Safari running for a long time (days/weeks) while doing lots of browsing.
Registered
 
This e-mail address is being protected from spam bots, you need JavaScript enabled to view it
5. 28-02-2007 21:50
 
Have you tried using a nightly build of WebKit? The memory footprint has been greatly improved in the last 18 months. If you come across any reproducible behaviour that leads to excessive memory use, it'd be great if you could file a bug report.
Guest
 
This e-mail address is being protected from spam bots, you need JavaScript enabled to view it
6. 28-02-2007 22:12
 
No, I haven't tried the nightly builds yet. Is there an easy way to revert back if things go wrong? Or do you need to do a backup? I think I'll have to try them out though. 
 
Also, I don't mind the high memory usage as long as it's being used effectively. I've got lots of RAM on my main machines (> 4 GB) so if Safari will us a lot of RAM to speed things up then that's good. But when I need to free memory for other applications (things start paging and slowing down) I need Safari to release memory when I close all (or most of) the windows.
Registered
 
This e-mail address is being protected from spam bots, you need JavaScript enabled to view it
7. 28-02-2007 22:16
 
The nightly builds are completely independent of the rest of the software on your system. They do not modify any system functionality, and reverting back to normal Safari/WebKit is as simple as double-clicking on Safari.app rather than WebKit.app.
Guest
 
This e-mail address is being protected from spam bots, you need JavaScript enabled to view it

Write Comment
  • Please keep the topic of messages relevant to the subject of the article.
  • Personal verbal attacks will be deleted.
  • Please don't use comments to plug your web site. Such material will be removed.
  • Just ensure to *Refresh* your browser for a new security code to be displayed prior to clicking on the 'Send' button.
  • Keep in mind that the above process only applies if you simply entered the wrong security code.
Name:
E-mail
Homepage
Title:
BBCode:Web AddressEmail AddressBold TextItalic TextUnderlined TextQuoteCodeOpen ListList ItemClose List
Comment:



Code:* Code
I wish to be contacted by email regarding additional comments

Powered by AkoComment Tweaked Special Edition v.1.4.3

Last Updated ( Monday, 26 June 2006 )
 
< Prev   Next >
designed by www.madeyourweb.com | joomla templates