Friday, July 31, 2015

This week in browser bits; runway memory edition

Submitted for your review, Firefox news,  Mozilla whining, Chrome tab “discarding”, and Claus deals with a runaway freight train -- no, scratch that -- runaway memory usage in Firefox.

To the rails!

Firefox News

The Firefox Extension Guru's Blog has been hard at work parsing details and analysis of coming changes in the Mozilla browser.

  • Truthful, but not very PC… - Firefox Extension Guru's Blog - Silverlight will be banished, Flash retained, and the 64 bit mainstream version release of Firefox x64 is delayed, and questions persist.
  • Win64 Firefox NOT Coming with Firefox 40 - Firefox Extension Guru's Blog - Maybe with Firefox 41?
  • A Look at Extension Signing In Firefox 40 - Firefox Extension Guru's Blog - The Guru goes to the mats for  us and loads his profile into Nightly 42, Developer’s Ed. 41, and Beta 40 of Firefox to take a look at the impact to users (and their Add-ons) with Extension Signing coming soon to a Firefox 40 release on your system.  Read his post for the full comparison. Summary: FF40 = warnings, FF 41 = blocks (but action can be user disabled), FF 42 = blocks (no disablement).
  • Disabling Add-on Compatibility Check - Firefox Extension Guru's Blog - Guide update notice and point to Disable Add-on Compatibility Checks Add-on for extended feature support. Note this Add-on appears to be very popular with Pale Moon users.

What Does the Fox Say?

(with a nod to Ylvis)

It’s probably not that long ago in most people’s minds to recall the great browser wars of the 90’s and the anti-trust settlement and also how the EU forced Microsoft to provide a default web-browser “ballot” to guide users to an alternative browser than Internet Explorer as the default.

Today although many users still turn to use IE on their Windows systems without question, there is general familiarity with alternative browsers such as Mozilla Firefox, Google Chrome, Opera, Apple Safari, and upstarts Vivaldi and Pale Moon-- to name a few. Their presence in the formerly IE dominated world has been hard fought; both in coding/development, in the courtroom, and in the marketplace.

So it was probably a frustrating day in many a browser boardroom when it came out that the Microsoft Windows 10 upgrade will automatically reset the default Windows web-browser setting to Microsoft Edge and over-write the user’s current default browser choice if it isn’t already IE. It will do this unless you are a pre-informed geek/user and choose to ignore the “express settings” option during setup and choose the “customize settings” option, and then carefully locate another button to make the option change to keep your settings. It isn’t a stretch to anticipate that most consumers eligible to get this Windows 10 upgrade will be more than happy to select the “no-pain/no-fear” “Express Settings” upgrade and toddler on with the process unawares (and get a whole lot of other potential security and privacy setting headaches along the way by default). More on that in a follow up post.

Anyways…

Mozilla for one isn’t taking that roll-back to Microsoft Edge browser by hiding out quietly in a foxhole. No, in a shout to equal the noise of Ylvis’s video they howled/barked pretty loudly.

Ooops. Did you click the “Express Settings” option? Fear not, here are some steps to get Firefox (or Chrome) set back to being your default browser.

Chromium Tab “discarding”

Memory management can be a real challenge for a “modern” web-browser. With the media-rich webpage content, and multi-process hosting in these browsers, keeping system memory usage in check and browser performance up is a developer’s constant nightmare.

My own browsing habits are such that I usually have no more than three or four browser “tabs” open at any given time. I generally file away pages to my bookmark manager to be saved for later review. The only time I regularly have more than 25 tabs open is when I am going through my RSS feeds in Omea Reader and launching them to open in the background in Firefox. Once done with the RSS feed culling, I then go to Firefox and sort them into a specific folder for topical blogging, or future reference.

Lavie on the other hand leaves fifty+ tabs open in multiple web browsers concurrently. Drives me crazy! But that’s how she works.

A new feature “tab discarding” has surfaced in Chromium builds. For those who have a lot of tabs left open, it will use an algorithm to trigger “discarding” open tabs when physical system memory is running low. My understanding that “discard” means something more like “suspend” rather that shut it down and toss it in the bin. If enabled and triggered, the tab stills shows on the tab-bar, but nothing is happening until you select the tab, when it then “revives” again.

I’ve enabled it in my Chromium build though I don’t expect to see much difference with my minimal tab usage. If it rocks my world I’ll let you know. Martin Brinkmann of gHacks has the “how-to” for enablement of the feature in his post below.

Per Brinkmann’s article, the Firefox BarTab extension has offered a similar feature to Firefox users for some time. The original BarTab by philiKON is not supported on Firefox 39 or higher. However a newer “fork” of it -- BarTab Heavy -- seems to be fine. See also this other fork BarTab Plus.

Claus Deals with Runaway Memory in Firefox

So this morning I happened to have my own struggles with Firefox memory usage so here are my notes.

I was tearing through my RSS feeds and opening articles of interest in the background within Firefox.

My tab bar was filled and more tabs were spilling over “hidden” off the left.

I eventually noticed a number of things…memory usage on my system was almost maxed out, though I just had a handful of applications open, and the laptop cooling fan had kicked on full-tilt.

I checked Process Explorer and quickly found the culprit for my RAM usage; Firefox!

osuyqzsh.qfq

Normally my system runs about 3.5 GB of RAM usage unless I have a VM open and running.

In this case my 8 GB of system RAM was almost maxed out and a large portion was being consumed by Firefox.

The RAM counters showing were continuing to climb mercilessly.

I started to try to save my tabs to the bookmark folders so I could close them out but after just a few, Firefox became locked up.

I killed the process and restarted Firefox. Luckilly my tab sessions were restored so I didn’t loose any of the open ones…but almost immediately, the RAM counters went climbing sky-high again to the 3 GB mark!  Did I have a rouge Add-on? Was one of the tabs hosting bad page code? What was going on?  I felt blind and Process Explorer wasn’t helping.

Step one: Make sure “Prefetching” was turned off.

How to stop Firefox from making automatic connections - Firefox Help - Lots of good advice here but this was the one I was interested in checking.

  1. In the Location bar, type about:config and press Enter.

    • The about:config "This might void your warranty!" warning page may appear. Click I'll be careful, I promise! to continue to the about:config page.
  2. In the about:config page, search for the preference network.prefetch-next.
  3. Observe the Value column of the network.prefetch-next row.
    • If it is set to false then do nothing.
    • If it is set to true, double-click on it to set it to false.

In my case, I had previously set it to “false” so that wasn’t a help.

Step two: Figure out what is consuming all the RAM within Firefox in the first place.

Firefox uses too much memory (RAM) - How to fix - Firefox Help

This page has tons of useful tips and tricks to try out; most are common sense like updating Firefox, disabling themes and add-ons, disabling auto-run of media on pages, using fewer tabs or adding more system RAM (really?).

However it was this tip - Memory troubleshooting tools - that had a great new find for me:

The about:memory page allows you to troubleshoot finely specific issues about memory (for instance, caused by a website, an extension, a theme) and sometimes its Minimize memory usage button may help you instantly reduce memory usage. For guidance on use of about:memory visit https://developer.mozilla.org/docs/Mo.../about:memory

Typing that in I get a page with some options to load memory reports, save them for later/diff’ing, free up memory, or save some garbage collection or concise cycle logs.

For first level stuff, hit the “Measure” button under the “Show memory reports” section and let it rip.

Here you can review all the different elements and how much RAM they are using.

fsbif4yj.uiv

Pretty helpful stuff.

Step three: check and enable trimming

Fix for Firefox memory leak on Windows - How-To Geek

  1. Type about:config in the address bar.
  2. Right click in the whitespace and choose New --> Boolean and enter.
  3. For the name provide “config.trim_on_minimize
  4. Set the value to “True”
  5. Shut down and restart Firefox.

Per MozillaZine Wiki this setting’s benefit is “dubious” but shouldn’t actually hurt anything if you are having issues.

Config.trim on minimize - MozillaZine Knowledge Base

Background

On Windows operating systems, when a program is minimized and left for a period of time, Windows will swap memory the program is using from RAM onto the hard disk in anticipation that other programs might need RAM. Because of the way Mozilla applications are stored in memory, Windows is much more aggressive in swapping out the memory they use, which can cause a delay when the program is restored. This preference determines whether to mark memory as preferably swappable, from a minimized Mozilla Windows application.

Recommended settings

Any positive effect of this setting is dubious, since any memory saving may be illusory.Bug 420267, comment 7

However, if you're experiencing problems with the application consuming too much RAM (Mem Usage in the Windows Task Manager), you can try setting this preference to true. If you're not experiencing any problems, it should be left at false to maintain application responsiveness.

Step four: Install an Add-on memory-monitoring tool

Knowing what in general is using RAM in Firefox (see step 2) is great, and disabling add-on one at at time to look for performance improvements is a great idea…though time-consuming if you have more than several. Luckilly, a solution was found in this gHacks post. Another Add-on!

Martin Brinkmann points out the Add-on about:addons-memory

It works great. Install the Add-on (no restart needed) and then type “about:addons-memory” in your address bar and it wills show you the memory usage of each add-on. How cool is that?  This can really speed up your troubleshooting.

Step five: Install a page-tab memory-monitor tool

Another add-on mentioned (that I haven’t tried yet) is Tab Data (+Memory usage) it offers to show memory use feedback on each open tab though reviews indicate some stability issues. See also Tab Memory Usage add-on.

Bonus Tip: About:About page

I’ve made a bookmark bar folder called [Abouts] that I then have placed various “about:” pages into it for faster access without having to type them. Go type about:about in the address bar to get the full listing but these are the ones I am interested in.

  • about:about
  • about:addons
  • about:addons-memory
  • about:cache
  • about:config
  • about:healthreport
  • about:memory
  • about:networking
  • about:permissions
  • about:plugins
  • about:preferences
  • about:support
  • about:telemetry

As of now, Firefox RAM usage hovers in the 500 MB - 1 GB range which seems pretty “normal” for me.

Hopefully one or more of these tips may help and if nothing else, give you some tools to better troubleshoot RAM issues in Firefox when you do encounter it.

Cheers,

Claus Valca

4 comments:

FF Extension Guru said...

"Lavie on the other hand leaves fifty+ tabs open in multiple web browsers concurrently. Drives me crazy! But that’s how she works."

Well, I suppose Lavie and I have something in common. Though I am not near the fifty+ tabs mark, may be a couple dozen.

" It will do this unless you are a pre-informed geek/user and choose to ignore the “express settings” option during setup and choose the “customize settings” option, and then carefully locate another button to make the option change to keep your settings."

That's the first I've heard of this. I am trying to put Windows 10 on one of my test systems. Neither one has been offered the upgrade (Win 7 Pro with SP 1 and Window 8.1 Pro). My two main systems a Win7 Pro HP Laptop I use for school and my Gateway Desktop Win 8.1 Pro have been offered the upgrade, but I don't want to do it on either of those machines.

I tried researching yesterday on the Win7 machine and I think it has been possessed by Hal. I started getting BSOD which I hadn't had on that machine in almost year after I did a clean install of Win7 Pro. Well, that was the excuse I was looking for to retire that machine (besides the fact it sounds like I have turboprop under my desk). So I retrieved the Dell Win 8 system that I created from an old Optiplex GX620 I picked up this past spring for a local eWaste harvester reseller. I am going to try to get Windows 10 on that over the weekend, though I fear I am going to have to download the update and then burn the ISO to a Flash Drive.

Claus said...

@ FF Guru - Fan-Fiction. That's all I'm saying...

RE: "Express Settings" yeah...it was a surprise to lots of folks. What's even more discouraging are all the privacy "roll-backs" that are coming in Windows 10 (by default) served up by Microsoft in Windows 10. I guess I expect that behavior in general terms in our current tech-age but still, the fact that they are buried and the preferences are "opt-in" by default is a bummer. You can go in and disable them manually with some effort. You can also disable some via the custom setup option but again...how many non-geeks are gonna do that when Microsoft is helpfully offering them a painless shiny Windows 10 auto-upgrade for free?

Be careeful on the Windows 10 upgrades at this early onset! I found some info that suggest many Dell laptops aren't yet "Windows 10" certified yet by Dell.

I've got a post coming up (tonight?) that goes over the latest privacy issues, tweaks, and upgrade challenges.

I've heard that just next week Microsoft may be releasing a big bug-fix "service pack" release already for Windows 10.

That's why -- as much as I want to at least upgrade Lavie's Dell laptop to Win 10 -- I'm holding off for at least a month or so before attempting to do so.

Stay tuned for the post as it may have some helpful tips for your travails...

Cheers!

--Claus V.

FF Extension Guru said...

Given the age of this Dell system I am using as a guinea pig I wonder if there might be some unforeseen issues. But again, it is a guinea pig and I am into that system about $75 ($50 of that was for RAM) so if Windows 10 does break it no big deal. I already retrieved the product key for that system, so I would just need to find the CD I burned with Win8 Pro and do a reinstall. There is absolutely nothing of value on that system so wiping it and starting fresh would not be a heartache.

It seems in this day and age everything is 'opt-in' for privacy stuff and heaven forbid Microsoft actually made something easy...remember this is the company that taught people to turn off their computers by clicking a button marked 'Start'!

Anonymous said...

Gratz on 10+ years of blogging!

I find your posts quite helpful, easy to understand and very informative.

Keep up the good work, cheers.