Watch, Follow, &
Connect with Us

Eli Boling

Safari, Flash and _MEMORY_

This is a little bit of a dead horse beating, but it’s still relevant, so what the heck, why not.  RAM is extremely important to me as a developer for the obvious reasons, so every once in a while, I look around at my processes, and see who’s being an oinker.  I was a little surprised at the results.

First of all, a reminder about my dev system:  Macbook Pro, running VMWare 3, which is constantly running Windows 7 Ultimate (32bit just now).  I keep a number of Mac apps up pretty much all the time.  These include Adium, Skype, Mail, iCal and Safari.  Safari typically has just one window open, pointing at gmail.  Throughout the day, I use Safari a lot, researching technical topics, researching software, reading news.  I may have a lot of windows/tabs active during a given session, but I generally close them all down after a while, and go back to the one.  For quite a while, I was just using plain old Safari out of the box, no extensions, no nothing.

So, one day, I go looking at my machine, looking for oinkers (BTW, oinker is slang for pig, in this case referring to any process that is being a memory hog), and what do I find?  Not VMWare, which is running a whole OS under the covers.  No, I find Safari and Flash, at the number one and number two spots.  And they are WAY ahead.  Both are using around 600MB Real Mem, and a similar amount of Virtual Mem.  And this is with one gmail window open.  And that Flash Player process will just never die, so long as Safari is up and running.  Well, I found that to be more than offensive, and at that level of usage, it’s actually getting in my way, so I spent some time reading up.  Lots of people said pretty much the same thing, but there was some variability.  Some people really didn’t see the same problem at all.  Eventually, I found ClickToFlash, which is a Safari WebKit plugin that stops Flash controls from executing unless you click on them.

So I gave ClickToFlash a try.  The Flash process disappeared from the memory profile altogether, which wasn’t too surprising.  What was interesting was that when I invoked Flash on places like YouTube, and other sites that have Flash content that I want to see, the Flash process was well behaved, and put itself to bed after the Safari tab in question closed.  Safari memory usage still crept up, but it seemed like it wasn’t quite so quick.

So, then Lee pointed me to the ad blocker and script blockers that he uses for Safari:  AdBlock, and JavaScript Blacklist.  I’ve used ad blockers on and off, but I have sometimes had troubles with sites that won’t work properly with them, so I’ve generally just trained myself to ignore ads.  Sometimes my kids will see something in an ad on a page I’m looking at, and mention it, and I’ll ask "What?  Where?"  They’ll have to point, because I just don’t look at or process those regions of the page.  The one exception is when a site has one of those expand down ads.  I really can’t stand those, because they scroll the page contents down, and then back up, and you have to wear out your knuckle a bit more on the scroll wheel.  I still don’t mentally process the content.  Anyway, I installed both these extensions, to see what happens.

Well, I’ll say that AdBlock seems to work pretty nicely.  A lot of pages I regularly use got very quiet, visually. Safari’s memory usage still creeps up, but again, not as quickly.  I’m still using ClickToFlash at this point.

So, I decided to try a regression, to test out an hypothesis:  does Flash memory oinkage (ok, now we’re making slang up.  Roll with it.)  come about because there are sloppy or maladjusted or malevolent Flash applets in some of the ads?  So I kept AdBlocker enabled, and disabled ClickToFlash.  What do you know, the Flash process stayed pretty well behaved.  I do see it floating around more, and I’ll probably re-enable ClickToFlash, just because there are some sites that use Flash in irritating ways that are not ads, but are still not something I want to see.  In any case, it’s my thinking, now, that Flash isn’t entirely to blame for being a memory hog, but I’m still keeping it on a tight leash.

Now, back to Safari.  It’s still a piggy.  With the three extensions above enabled, the Real Memory usage still drifts up and up during an 8 hour period until it sits, generally, for me, at about 650MB.  It usually plateaus there.  There’s an additional 600MB of Virtual Memory in use.  This past weekend, I spent a bunch of time playing around with Network Attached Storage.  I ended up doing a lot of searching on the topic, in conjunction with Time Machine.  That will be the topic of another blog post, I can tell you.  During that session, which was primarily on blogs and forums, and a few product pages, Safaris Real Memory usage went to 1.6G, and the Virtual Memory to 1.7G.  When I closed down all those pages and went back to my one gmail page, Real Memory drifted back down to 1G.  I left it overnight, and it was still at 1G.  I’m sorry, it’s just a hog.  I’ll be fair:  I haven’t done the same experiment on FireFox, or Chrome.  I should, and I probably will.  Right now, I feel like I’ve got back 600MB of Real Memory by nuking the Flash hoarding, and I’ve got things to do, so I’m not going to dig into FireFox or Chrome just yet.  If anyone has numbers on those, I’d love to hear them.

Last item - I didn’t say anything about JavaScript Blacklist.  It’s probably not relevant to the memory thing, but it fits into the ancillary category of ’stomping on things that irritate me’.  JavaScript Blacklist stops things like IntelliTXT.  I’ve nothing at all good to say about IntelliTXT, or any of the other flyover-get-in-your-face-parasites.  In the past, if you had a page that used these, I would never return to it.  Now, I’ll never know.  One aside, though: JavaScript Blacklist blocks tynt.com’s scripts.  Up until a short time ago, I’d never heard of tynt.com.  I did some searching (oink oink), and saw people really ranting about it.  Basically, a site that uses tynt.com scripts intercepts copy operations, and if you copy text off the site, it inserts an attribution URL.  Places like major newspapers use this.  This actually seems reasonable to me.  I mean, if you are copying the content from a site like that, well, you should be making an attribution, at the least.  If you don’t like the link, you can strip it out when you paste.  Seems to me that people are a little too free with copying content that’s actually not theirs to copy.  It’s called plagiarism, or copyright infringement.

Here are links to the three nifty little products that I’ve now got for Safari:

http://safariadblock.com/

http://homepage.mac.com/drewthaler/jsblacklist/

http://clicktoflash.com/

Posted by Eli Boling on February 24th, 2011 under OS X, Uncategorized |



3 Responses to “Safari, Flash and _MEMORY_”

  1. David Clegg Says:

    When I first switched to my Macbook Pro (used primarily for Windows development), I only had 4GB of RAM to play with. As such, memory was a very precious commodity. I initially was using VMWare for virtualization, but switched to Parallels after finding it worked better in my resource constrained environment. I also found Chrome to be generally more responsive, and a bit less of a memory hog than Safari, although I found it was a little inconsistent with accurate rendering of sites.

    I’ve not got 8GB of RAM, so I’ve switched back to Safari, but I’ve stuck with Parallels. It may be worth investigating that to see if it fits well with the way you work. Both VM solutions have their quirks though, so I’d definitely recommend taking the trial for a spin. While there is no VM import facility as such, I was able to easily clone my VMWare VM into a new Parallels one (although I had to forgo all snapshots in the process).

  2. George Feamster Says:

    I have 8gb in my 2010 17 inch mbpro and memory usage is still worth watching. I use VMWare myself and own Parallels as well. Until the current version of Fusion, Win7 was a snail compared to Parallels but they are much more equivalent now and I don’t plan on playing games in a VM. I primarily use VMWare when developing so that I can provide the image to my clients and they can download what they need to view it on their Windows machines (VMPlayer).

  3. Michael Thuma Says:

    If you one day look what happens in background, how many files are kept open … Google is very painful still … together with Flash is one thing but make beta tests of online games that crash … and you will see how fast your machine becommes slow and inrepsonsitive….

    Mike/Bunny

Leave a Comment



Server Response from: BLOGS1