Author Topic: Rx for memory hogs from Mozilla?  (Read 407 times)

elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 4208
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, MacBook Pro (Mid 2009)
Rx for memory hogs from Mozilla?
« on: April 20, 2017, 11:14:11 PM »
Dear WeatherCat users who never seem to have enough memory,

A number of us has noticed a slow parasitical memory use that eventually consumes all the available memory on a Mac.  It certainly exists on Mavericks, Yosemite, and El Capitan.  Supposedly there have been improvements in macOS Sierra that perhaps have resolved these problems.

Given the number of "memory cleaner" applications on the Mac App store, it is clear that this is a common problem.  Alas those programs may not be the best medicine.  There is a command line alternative called purge.  It needs to be invoked in the terminal as a super-user like this:

sudo purge

There is one unavoidable hassle associated with this: having to type your password at every invocation.

There is a lot of debate about whether this is a good idea or not, but I discovered that using the purge command has a very surprising effect after running any of the Mozilla based applications like Firefox, Waterfox, or Postbox.  Even if these applications are on the order a few hundred megabytes, purging the caches typically recovers around a gigabyte of RAM!!  The free memory cleaner app I was running could not recover anywhere close to the same amount of memory.

My suspicion is that there are bugs in the Mozilla code that cause it to be unable to cache data efficiently.  As a result, repeated use of these programs cause the caches to grow very rapidly and the data doesn't get reused correctly.   Efficiently, the caching is basically worthless and the RAM on your computer is rapidly consumed.  Since I use Waterfox (formerly Firefox) and Postbox a great deal during the day, I was being forced to reboot as often as once a day.  Through periodic purging, I could go as long as 2 weeks without rebooting.

As noted by board member Weatheraardvark, Safari appears to be more efficient in memory use and does not appear to generate the amount of cached data Mozilla family appears to generate.  That is a more memory friendly alternative.  However, if you are addicted to the Mozilla family of products, periodically running the purge command may be a reasonable compromise to avoid rebooting your computer all the time.

Cheers, Edouard

xairbusdriver

  • Storm
  • *****
  • Posts: 1631
    • EW7115 (E7115)
    • KTNGERMA20
    • Mid-South Weather
  • Station Details: Davis VP2 wireless w/remote wireless Anemometer Kit
Re: Rx for memory hogs from Mozilla?
« Reply #1 on: April 21, 2017, 03:30:54 PM »
Somewhere in the prefs of Safari (and probably in most browsers) is a setting to set the amount of ram it can use for cashes. I set mine to zero many years ago since I often edit web pages almost every five minutes. That is then followed by a refresh of the page. Obviously, I don't want the cashed page but the just updated one. So far this adjustment has served me well. Of course, it helps to have a fast interweb connection, don't try this if you are still using a 300baud modem! ;)

Blicj11

  • Storm
  • *****
  • Posts: 2399
    • EW3808
    • KUTHEBER6
    • Timber Lakes Utah
  • Station Details: Davis Vantage Pro2 Plus | WeatherLinkIP™ Data Logger | iMac (late 2013), 3.5 GHz Intel Core i7, 24 GB RAM, Sierra | Sharx SCNC2900 Webcam | Supportive Wife
Re: Rx for memory hogs from Mozilla?
« Reply #2 on: April 21, 2017, 11:17:51 PM »
Somewhere in the prefs of Safari (and probably in most browsers) is a setting to set the amount of ram it can use for cashes. I set mine to zero many years ago...

Yes you did, but about 10 years ago, Apple removed this option from Safari. The best you can do now is clear your cache. Firefox has a maximum cache setting, but not Safari.

You can totally disable caching in Safari, via the Develop Menu, but this is highly obnoxious unless you are working on a website, etc.
Blick


elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 4208
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, MacBook Pro (Mid 2009)
OS X caches not used by Mozilla (Re: Rx for memory hogs from Mozilla?)
« Reply #3 on: April 21, 2017, 11:31:22 PM »
Dear X-Air, Blick, and WeatherCat memory dieters,

Somewhere in the prefs of Safari (and probably in most browsers) is a setting to set the amount of ram it can use for cashes. I set mine to zero many years ago...

Yes you did, but about 10 years ago, Apple removed this option from Safari. The best you can do now is clear your cache. Firefox has a maximum cache setting, but not Safari.

I am ever so sorry you mentioned this.  Not because it is incorrect, but precisely because it is correct and I have my cache set to limit of 10 MB!!   :(

I don't think the purge command has any effect on Mozilla caches.  I assume Mozilla attempts to have their own independent cache system because their products run on multiple operating systems.  However, after exiting Mozilla applications and running the purge command, I usually free up at least 1/2 GB of RAM.

Now that I think about it, of course it is reasonable to use this command.  Since Mozilla is using their own cache system, the Apple caches aren't being used.  Because Mozilla isn't using them, whatever Apple is storing in them is never reused.  As a result, whatever mechanism is causing this caching can only add more and more stuff to those caches.  Because of the disconnect between Mozilla and OS X, those caches are effectively a storage from which nothing can return.  Since clearly they are filled up at an outrageous rate, purging those caches is indeed the only way to keep your computer from needlessly running out of memory.

WOW!  That's a really discouraging thought . . . . . 

Oh well, . . . . . Edouard

Blicj11

  • Storm
  • *****
  • Posts: 2399
    • EW3808
    • KUTHEBER6
    • Timber Lakes Utah
  • Station Details: Davis Vantage Pro2 Plus | WeatherLinkIP™ Data Logger | iMac (late 2013), 3.5 GHz Intel Core i7, 24 GB RAM, Sierra | Sharx SCNC2900 Webcam | Supportive Wife
Re: Rx for memory hogs from Mozilla?
« Reply #4 on: April 21, 2017, 11:45:40 PM »
Thought-provoking post, Edouard. I used Firefox for years. When they moved to a development cycle that pushed updates out every few weeks I got tired of that and switched to Safari. I am mostly happy with Safari and almost exclusively use it in the Private Window mode. I don't have anything to hide, but I noticed that when I made an online purchase, the item I bought immediately started showing up in on-screen ads everywhere I went on the web. I learned that if I made a purchase in a Private Window, my purchase did not influence browser ads.
Blick


xairbusdriver

  • Storm
  • *****
  • Posts: 1631
    • EW7115 (E7115)
    • KTNGERMA20
    • Mid-South Weather
  • Station Details: Davis VP2 wireless w/remote wireless Anemometer Kit
Re: Rx for memory hogs from Mozilla?
« Reply #5 on: April 22, 2017, 04:42:27 AM »
Quote
...but this is highly obnoxious unless you are working on a website, etc.
Funny, I guess I do a lot of that "etc." stuff along with my METAR parsing editing. Fortunately, that seems to be nailed down pretty well. I am seeing miss-spellings, however. "ONCL" instead of "OCNL". [banghead] Those are not as easily handled but thankfully rare.

I can't remember the last time i felt "obnoxioused" ... err "obnoxiated"? I rather enjoy having a page actually update when I ask it to. Sometimes I'll enable javascript or Flash when the page absolutely has to have it [rolleyes2] and it's nice to have the page refresh as instantly as I can "see/feel" it. Of course, as I said, one will need a fairly fast interweb connection. [rockon]

Whether it's using Safari and Apple reducing the memory leaks or just disabling caches I'm a happy old "surfer dude"! ThU32:-)

Weatheraardvark

  • Strong Breeze
  • ***
  • Posts: 167
    • C0005
    • KIADESMI1
    • Des Moines Weather and Climate
  • Station Details: Davis VP2 Plus, is that better?
Re: Rx for memory hogs from Mozilla?
« Reply #6 on: April 22, 2017, 02:31:39 PM »
When I use Firefox for mac,  I notice that it causes my imac to heat up very quickly from the cpu time it uses.   the fans kick in.  and the temperature drops below 167F, but with Safari it does not heat up. I have two USB fans running at the rear of the unit, on blowing on the back and the other down were the air intake comes in.   These temperature spikes are a lttle much.

Firefox right now is using 1.13GB of memory, and 63.7% Cpu


The bear is that many data bases I have to use  require Firefox.  I could stand Safari if I could get the bookmark bar behave much like Firefox. 
Davis VP2 Plus; 24h  FARS; Extra Temp Humid sensor (2); Extra Temp Station (2); Soil Moisture/Temp Station;Weatherlink IP;USB; MAC Sierra; Bloomsky Sky 2; https://map.bloomsky.com/weather-stations/faBiuZWsnpW6n6il
http://www.desmoinesweather.org
https://www.wunderground.com/webcams/JoeToubes/2/show.html

Steve

  • Global Moderator
  • Storm
  • *****
  • Posts: 1203
    • DW8454
    • KOHAVON11
    • Avon Weather
  • Station Details: Davis Wireless VP2 Plus w/24 hr FARS, Leaf & Soil Station, 27" iMac 2.7 GHz i5, 32GB RAM, Mac OS 10.12, WeatherCat
Re: Rx for memory hogs from Mozilla?
« Reply #7 on: April 22, 2017, 03:49:12 PM »
When I use Firefox for mac,  I notice that it causes my imac to heat up very quickly from the cpu time it uses.

Deb's MacBook Pro does the same. Safari never gets it hot, but anytime she uses Firefox, we have to put a couple pencils under it and the fans stay on almost constantly.
Meteotemplate Testing

Steve - Avon, Ohio, USA
Current WeatherCat Status


CWOP: DW8454 • WU: KOHAVON11 • AWEKAS • CoCoRaHS • Skywarn •  UK Met Office
MWWN •PWSweather • WeatherBug • WeatherCloud • Twitter • Facebook

Blicj11

  • Storm
  • *****
  • Posts: 2399
    • EW3808
    • KUTHEBER6
    • Timber Lakes Utah
  • Station Details: Davis Vantage Pro2 Plus | WeatherLinkIP™ Data Logger | iMac (late 2013), 3.5 GHz Intel Core i7, 24 GB RAM, Sierra | Sharx SCNC2900 Webcam | Supportive Wife
I don't think the purge command has any effect on Mozilla caches.  I assume Mozilla attempts to have their own independent cache system because their products run on multiple operating systems.  However, after exiting Mozilla applications and running the purge command, I usually free up at least 1/2 GB of RAM.

Now that I think about it, of course it is reasonable to use this command.  Since Mozilla is using their own cache system, the Apple caches aren't being used.  Because Mozilla isn't using them, whatever Apple is storing in them is never reused.  As a result, whatever mechanism is causing this caching can only add more and more stuff to those caches.  Because of the disconnect between Mozilla and OS X, those caches are effectively a storage from which nothing can return.  Since clearly they are filled up at an outrageous rate, purging those caches is indeed the only way to keep your computer from needlessly running out of memory.

I agree. You will also need to clear the cache in Firefox itself by setting it to clear history when you close it.
Blick


elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 4208
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, MacBook Pro (Mid 2009)
Odd about the CPU issues (Re: Rx for memory hogs)
« Reply #9 on: April 22, 2017, 11:12:27 PM »
Dear X-Air, Blick, Weatheraardvark, Steve, and WeatherCat web surfers,

Interesting. . . . . I have a 2011 MacBook Pro so nothing particular modern, but rarely did Firefox cause a lot of CPU load.  Waterfox does a bit more, but mostly on website with a lot of banner ads.  Is that one of the main culprits?

Today was a major assault on the yard, so very little computer time.  However, I stumbled into this article on improving the performance of Firefox:

http://www.online-tech-tips.com/computer-tips/speed-up-mozilla-firefox/

I just barely glanced at it but there are options in controls that I didn't even know existed!  It may not get Firefox zipping like Safari, but if you are addicted like me, perhaps it will help.

Cheers, Edouard

xairbusdriver

  • Storm
  • *****
  • Posts: 1631
    • EW7115 (E7115)
    • KTNGERMA20
    • Mid-South Weather
  • Station Details: Davis VP2 wireless w/remote wireless Anemometer Kit
Re: Rx for memory hogs from Mozilla?
« Reply #10 on: April 23, 2017, 12:55:42 AM »
"Banner Ads"! Why, pray tell, are you allowing those?! [rolleyes2]

elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 4208
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, MacBook Pro (Mid 2009)
Did I say I didn't have enough time? (Re: Rx for memory hogs)
« Reply #11 on: April 23, 2017, 11:32:52 PM »
Dear X-Air and WeatherCat types with way too many things to do this spring?

"Banner Ads"! Why, pray tell, are you allowing those?! [rolleyes2]

I haven't had time to update privoxy to the latest version.  As a result, its filtering rules are out of date and some banner ads are getting though.  Just another thing on my way too long to-do list . . . . .  [banghead]

Edouard