Author Topic: Howto: Advice on Firefox Memory Hole  (Read 580 times)

0 Members and 1 Guest are viewing this topic.

Offline copb.phoenix

  • So long and goodnight
  • Purple Level
  • *
  • Posts: 2229
  • Cookies: 115
    • FurAffinity - copb_phoenix
Howto: Advice on Firefox Memory Hole
« on: March 13, 2010, 08:04:57 pm »
First off, sorry, but I do need to explain what a memory hole is for the unaware:



Figuratively, in any computer, you have various sorts of memory. One of these is RAM - Random Access Memory. RAM is most often used to store active programs and data that is currently in use or may potentially be in use soon. When there is no more RAM left to store this information, some of what is currently in RAM gets pushed to your hard drive, which is meant for slow access and long term storage. The area this information is pushed to is called the cache.

Obviously, that's the basic, watered down, barebones version of computer memory. When you have a memory leak in a program, it constantly requests that more memory be allocated to it from the system. While I cannot say much for Firefox's love of eating out whatever is available (try Flock or Wyzo for something on Mozilla framework but quick and light), you may find the contents of this useful if you're having troubles with your RAM usage creeping up and your cache being written into/read out of quickly (this is referred to as "cache thrashing").



In Firefox, the cache-thrashing memory hole seems to be caused by a handful of things. They are:
- The scanahead used to feed you bookmarked/history results when you go to type addresses.
- Poor default settings for memory management.
- The security options and a few settings.


I'm certain there are more, and that others may have their own solutions. However, I'm going to work from the top down on that list providing possible solutions to try, which, hopefully, will keep Firefox lovers from giving up just yet.

Fix one: Address Bar Thrash: Clear your history and cache!
I'd hope this would be a given, but if you start thrashing and eating a memory hole and it's never happened before, your first instinct should be to clear your history! In Firefox 3.6, you can do so by going to your menu bar at the top and selecting:

Tools -->
Clear Recent History

When it opens, be a power user! Set your time range to "Everything", then pop open the details and make sure that "Cache" and "Browsing and Download History" are both checked. (NOTE: If Firefox users haven't cleared their cache in compliance with Natasha's requests, consider this a good start and a lesson for later.)


Picture of what you should see,
if you're following along.

Sadly, this is only a temporary fix at best, because your browsing will refill the cache and the history as you go along. It can be annoying, but be aware that this should always be your first option before something else more drastic.

Fix two: Disable Suggestions in the Address Bar
This may or may not be an option, based on what you personally like. If you like having stuff suggested to you in the address bar, this isn't for you. However, if you type full addresses or redirect keywords anyway, you might consider this.

To disable autosuggestion for addresses, do the following:
Top menu/menu bar -->
Tools -->
Options -->
Privacy Tab -->
At the bottom: Location Bar

The suggestion for this fix is to set it to nothing, but maybe leave bookmarks if you mark stuff for later.


Again, an image to help
you see this.

Fix three: Set Memory Settings to Match Your Machine
Warning: The following tip relates to things with the potential to void your warranty.

Did you know that Firefox has a hidden config page for a number of lower level things? It's true - the name of the page is about:config. You can reach it by typing that into your address bar in Firefox. Please do that.

W... Wait, what?


I think they're trying to tell us something.

If you've never learned the greyhat school of ethics, it's time to learn two core pieces:
- Ends must justify means BEFORE, not AFTER, taking a course of action.
- You get in, do exactly what you mean to do, and get out. No exceptions.

I'm quite serious. While what I'm going to have you doing through the rest of this is mostly memory and cache/paging settings, there are other settings in this that can cause Firefox to crash and burn. Permanently. So don't play around unless you've studied this stuff enough to know better or it's your career. No, I will not accept hobbyists this time around.

That being said, I want you to make both me and the esteemed Firefox team the promise on that button, and click it.

This is the underlying config setup. Nothing extremely special - actually, quite similar to portions of the Windows registry or those .ini files you might find about. I'd highly recommend you follow that second collorary above and use the filter to find the following entry:
browser.cache.memory.enable

Make sure it's set to "True".

Once you've done that, you need to fabricate some figures for a very old Firefox feature that allowed you to specify the amount of memory to give it. Right click somewhere in blank space below that entry, and select New --> Integer.

Copy and paste the following as the name of the entry:
browser.cache.memory.capacity

Set the value to -1 for the moment, then filter back to it if you've not done so yet.

For this one, I'm going to point you to one of my resources before anything else:
http://kb.mozillazine.org/Browser.cache.memory.capacity

Note the defaults. If you go over them for your system and something bad happens, I'm not going to be of much help. Use those as your UPPER LIMIT for memory allocation, not a soft suggestion.

Now, if you read that, -1 is already the default for Firefox 3.6. I had you set it to get it out of the way; what you want to do now is explicitly set the memory somewhere a decent ways below whatever your upper bound is on that page. It's in kilos; so, if you're me, who has 1 GB of RAM, you'll come to the following conclusions:
- I have 1 GB total RAM.
- Mozillazine says that 18432 kb is the default setting for me.
- *nix is saying to use that as an upward bound and shoot a little low of it.
- I think I'll try 17500 kb, since that's a nice round number well below it.
- I'll change my browser.cache.memory.capacity value to 17500, then.

(Right-click --> Modify.)


Let's be clear: If you have 1 GB total RAM, this is a possible setup
for you for this fix. Don't just assume this is correct if you don't have
AT LEAST 1 GB of RAM.

That's it. You should seriously consider closing that tab now.

Fix four: Death to security settings that make no sense!
You know, I've never had the phishing filter go off on me and be correct. I see no reason to keep it. And it turns out that security settings are one of the things that cause cache-thrashing in Firefox, because a small database is stored on your hard drive for them. That seems highly... Unintuitive.

This one won't void your warranty, but is bad practice if you click every single link you come to or like to carouse random corners of the web for po mixed media of a clearly tasteful manner. Take mind of that before trying it.

To disable the offending security settings, go back to your handy menu bar.
Tools -->
Options -->
Tab: Security.

Uncheck the two top values starting with "Block". That's it.


Let me stress this again - if you're the least bit unsure
of yourself, don't do this. Don't even think about it.




I realize that those last two are a little risky, and I'll again stress: If you are uncertain about yourself or how reliable I may be, then don't do it. Don't even consider doing any of the things on this page; it is not worth ruining your Firefox installation to try.

That being said, I've seen a few other fixes related to the about:config page, but I want to leave those until after I do a bit of research and see if this stays afloat or what. I'm open to any questions or anything I need to clarify, though.

EDIT: I really need to start using the preview feature for these long posts.
« Last Edit: March 13, 2010, 08:08:48 pm by copb.phoenix »
  • Flag - turing
  • Award - Beta Tester
Isn't this where...?