Why you may want to clear the Firefox cache from time to time
I recently noticed a big drop in available disk space on my computer's main hard drive. Since it is a Solid State Drive with only 128 Gigabytes of storage, I'm observant when the available storage drops below the 10% mark on the drive.
A drop in available space can come quicker than you think, for instance by using a tool to convert videos to DVD movies.
Since most programs use the C: drive as a temporary space for conversions, and also to place the finalized product on, it has happened in the past that a single conversion dropped storage space by nearly 10% as well.
This time though, things were not as easy to find out at first. I noticed that the space dropped below the 10 Gigabyte mark, which is problematic if you are running a SSD as it may have an impact on the drive's performance.
Whenever I want to analyze the disk space, I use a program like TreeSize Free to do so. While it is certainly possible to browse folders and files manually, it simply takes to much time to be effective.
I noticed a huge Mozilla Firefox profile directory after the scan. The directory used more than 9 Gigabytes of space.
Update: As some users pointed out, the large cache directory has been caused by an experimental feature that is only available in Firefox Nightly, and not in other versions of the web browser. It is still a good idea to check the size of the cache regularly to make sure that it does not overflow.
Further investigation revealed that the majority of space was used by the cache2 directory of the profile folder, indicating that it was temporary data that was taking up that much space on the system.
I decided to clear the browser cache using Firefox's own delete history menu. The use of the Ctlr-Shift-Del shortcut displayed the window, and I configured it to delete all cached files of the browser.
To my surprise, it only cleared about 1.3 Gigabytes of cached files in the profile folder, which meant that about 8 Gigabytes were still stored in the folder. Puzzling, to say the least.
I decided to look in the cache2 folder manually, and found only a couple of leftover files in there. This meant that the cache had been cleaned successfully, and that TreeSize Free had not updated its display properly.
I restarted the application and it too did display the correct cache amount afterwards.
Almost 9 Gigabytes of cached files is a lot. I'm not entirely sure why Firefox accumulated that much storage space in first place.
I made the decision to configure the browser to clear the history automatically on exit, to make sure that I would not run into the issue again at a later point in time.
You can do so in the following way:
- Tap on the Alt-key on your keyboard to bring up the menu bar.
- Select Tools > Options from the menu.
- Switch to the privacy tab here and select "Use custom settings for history" under History.
- Check the "Clear history when Firefox closes" box and click on Settings afterwards.
- Check "cache" at the very least and click ok.
- Note, if you select cookies, your signed in sessions on websites and services are removed, which means that you will have to sign in again the next time you use them.
- If you select Browsing & Download History, Session Restore won't work. This means that the tabs from last session won't be opened and that you cannot restore them either.
Now Read: Try these fixes if Firefox is slow
From where did you get the cache2 folder? :)
I don’t have one. I only have Cache folder and all cache files are stored in it…
It is an experimental caching feature in Firefox.
It is an experimental feature.
What’s cache2? I don’t have that folder, only Cache.
Its new cache mechanism firefox adding to improve cold startups and also warm startup, not to mention it will reduce Disk I/O and thrashing as well.
You should not enable new cache mechanism on SSD yet because it does not have any eviction policy. It will be bad for SSD write cycles.
Premature feature, so don’t go for it until Honza (developer) add eviction policy.
It’s only in Nightly, and currently disabled by default, iirc.
I like your site and articles in general but this article is pointless because cache2 folder is created in mozilla directory only when you are using testing versions of the browser and manually enabled new testing cache feature in about:config. And if you are done so, you should already know there are some issues with new cache and bugs are already filed on bugzilla website.
Don’t use features you have no knowledge of (and spread false rumors why you need to clear cache in firefox). In normal usage of firefox cache folder is limited to 1024 MB.
It is not a false rumor and the article is not claiming that Firefox is using more cache space than other browsers. And even if it is an experimental feature, it may help others who ran into the same issue.
I have added an update to the article to reflect that this has been caused by an experimental feature.
One has to flip a pref in about:config to enable it, so this only a problem for people who enabled it. The bug is known for Moz, I think it is bug No. 913808
Cache2 is a rewrite of the current cache, designed to better in certain aspects. It is under active development and is disabled even in Nightly. More can be read about it on http://www.janbambas.cz/
i keep my cache in firefox but always delete old cache with below addon
Ah, found some further info. Appears that cache2 is experimental and those who don’t use a nightly build won’t have such a folder.
How did you make cache size so large ? Mine goes only till 1 gb . Can’t set more than that in Settings –> Advanced–> Network –> Cached web content .
It is an experimental cache that needs to be activated in Nightly: https://www.ghacks.net/2013/09/23/mozilla-launches-firefoxs-new-caching-back-end-nightly-version/
I always enter browser preferences and limited by browser cache to 256Mb or less. If I had a slow internet service or was bandwidth metered by my ISP, allowing a large browser cache might be of some value. Otherwise, I see little or no benefit to allowing my browser cache to consume gigabytes of storage space.
Firefox’s caching may also cause problems with Moodle, the widely used instructional student/teacher application. After several Moodle freezes the university IT staff recommended my wife clear Firefox’s cache before she starts work on her instructional data. (She uses a Mac, FWIW.)
You can also configure Firefox to cache only to ram, not the hard drive. This can help with optimization and privacy. However, it is recommended that you only cache to ram if you have at least 1 gigabyte of ram.
This add on can configure Firefox to cache only to ram for you: https://addons.mozilla.org/en-US/firefox/addon/calomel-ssl-validation/
More information on the ram feature and the rest of the add on: https://calomel.org/firefox_ssl_validation.html
“the space dropped below the 10 Gigabyte mark”
So are you a data pack rat? :)
I too wonder how it got enabled.
should be 0
Well I know that I did enable it but forgot about it ;)
I always disable the Firefox’s disk cache, because I see no real need for it.