Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I avoid causing memory leaks in Firefox?

It seems that there is a lot of information on memory leaks in IE and how web developers can avoid them, but I can't find much on avoiding leaks in FF. I've found lots of random tips on how end users can tweak their preferences, or tips for extension developers, but little on what I can do as a web developer to make sure my pages don't leak. Am I missing something? It seems lazy to just blame it on the user and say "you've got too many extensions". Or are the major patterns the same as in IE -- circular references and all that?

Also, if anyone knows of any tools to troubleshoot leaks in FF, that would be great. I found this: https://addons.mozilla.org/en-US/firefox/addon/2490/ But it's apparently just for chrome and extension development.

like image 608
mrdanimal Avatar asked May 20 '10 17:05

mrdanimal


People also ask

Does Firefox have a memory leak?

Firefox memory leak issues can be caused by certain plugins or browser preferences. To troubleshoot the Firefox memory problem, you should check the browser's preferences and installed extensions. The browser also has a handy memory usage option that you can use.

How do I find a memory leak in Firefox?

The most basic way to detect a memory leak in Firefox is through a task monitor program like Task Manager in Windows or Activity Monitor in OS X. In these programs, you can monitor memory usage over time and see whether RAM levels keep increasing regardless of activity.

How much RAM should Firefox use?

On the final test, with 40 tabs open across two instances (20 tabs apiece), Edge required 2.5 GB RAM altogether, while Chrome needed 2.8 GB and Firefox needed 3.0 GB.


2 Answers

Outside of the design patterns to favour the only truely safe way is to test your pages thoroughly. To monitor the memory usage of the browser Task Manager is alright but Process Explorer provides more accurate results.

JavaScript is one cause of memory leaks but be careful with flash movies on pages too. Our content team added a movie from our design department that used a thrid party transition affect and this swallowed 10Mb every 20s or so. Just watching the movie loop through it was obvious in TaskManager to see the memory jump when the affect occured and the it never quite release it all back.

like image 181
Dave Anderson Avatar answered Sep 17 '22 20:09

Dave Anderson


You can force to run a Garbage Collector in FireFox. The Garbadge Collector will destroy & release objects that are not used anymore. The only possibility of "Leaking memory" with a Garbage Collector is not a "leak" but a reference which makes no sense: remove all references to objects that you don't want to use.

Read more on this page:
http://adblockplus.org/blog/different-ways-to-force-garbage-collection

like image 23
Pindatjuh Avatar answered Sep 19 '22 20:09

Pindatjuh