* Type “about:config” in the browser bar
* Search browser.sessionhistory.max_total_viewer
* Set the value to 0
What we are changing here, as per the Firefox Knowledgebase is that we are reducing the number of pages stored in your Firefox cache. That is the number of pages that are stored in memory so that when you click on the “Back” button, there is a least delay in the loading time of the page.
Setting the value to 0, helps to recover the RAM, because Firefox does not save pages in the cache, but if you decide to go back then it will force the browser to reload the page completely.
You can experiment with different settings (the default is -1, which calculates the number of cached pages, according to available RAM).