Firefox Memory Leak

Posted onby

Some of you will love this, and some of you are going to flame me. I don’t care about the haters though. Even though a fellow TYPO3 developer friend pointed out regarding my solution, “There has to be a better way. There probably is”, I’m posting this as a help to all the Firefox users of the world who are sick to death of the phantom Firefox memory leaks.

  1. How To Fix a Memory Leak In Mozilla Firefox Posted by: Sarah Clements on February 23, 2015 in Help/FAQ, Technology Leave a comment 3,111 views 0 Accounting for 23.6% of all Internet traffic in December 2014, Mozilla Firefox is the world’s second most popular web browser ( source ).
  2. Firefox memory leak and freezing. Has anyone else seen any issues with YouTubeTV and Firefox causing a memory leak? I can watch TV for maybe 2 hours before Firefox.
  3. I get the same results from a system scan, although I'm using Firefox. No need to worry, though. It seems that all browsers suffer from memory leak. If you want, you can periodically restart your browser to combat this, but it really shouldn't have any impact on your system unless you are running a very old system with low RAM.

We all know Firefox leaks memory for one reason or another. It’s been years. Plugins have come and gone and Firefox just leaks all the time. Period. What to do?

Firefox memory leak 2019

VERY bad memory leak Firefox 4 RC1. Open 4 tabs going to random sites 2. Leave Firefox open for 2-3 hours, my particular instance was open for about 12 hours 3. There were previous instances when Firefox consumed about 80% of the RAM. However as per this discussion some of the users feels that the more memory is used the better because it means you don't have RAM wasted. Firefox uses RAM to make its processes faster since application data is transferred much faster in RAM.

It’s time to hit Firefox with a sledgehammer. Like a boss.

Firefox

This requires just the slightest bit of Mac OS savvy, but not much, or else I couldn’t have done it. Windows is a bit easier, but I’ll post the Mac version first and follow up next week with the Windows solution.

The solution is to simply kill and restart Firefox as quickly as possible. Boom. Done. Firefox goes from sappy to snappy in about 1 second. Firefox tries to restore you tabs when it “crashes” so you should be good. On the Mac, you might get the “restore” or “new session” buttons. On the PC, for me at least, it comes right back up without the question.

This has been tested on Firefox 3.x, 4, and now 5 on both Mac and PC. Your mileage may vary.

Make sure you aren’t composing an email in a webmail interface or anything before you test this!

But wait! Am I really sure Firefox has a memory leak? I present my anecdotal evidence:

How to kill and restart Firefox on a Mac in 1 second

  • Create a text file, like “killFirefox.txt” somewhere on your Mac.
  • After saving it as a .txt file, change it to “killFirefox.command”
  • Paste this into it:
  • Now open Terminal and navigate to wherever you saved the file. You’ll have to Google how to use Terminal commands, or get an “open terminal here” plugin for Finder (like I have)
  • Once you are in the directory where “killFirefox.command” is, run the following command to make your .command file executable. This means that after you do this, you’ll be able to double-click “killFirefox.command” and the script will run:
  • Now go back to Finder or wherever you saved the file, and drag it to the RIGHT side of the “dashed line” on your dock if you want one-click access to the process:
  • Try it!
  • Happy Firefox rebooting! Goodbye slow and sappy Firefox—until a real solution is in place!

Firefox Memory Leak 2020

You may have to alter the “sleep 1” to something longer, like 2 or 3 seconds if your Mac is too slow. You may also have to put in a different path, but I’m no terminal expert. Also, to set the Terminal window to close after the process finishes, you’ll have to edit the preferences like this: Terminal > Preferences > Settings > When the shell exits = Close the window

Memory

How to kill and restart Firefox on a PC in 1 second

  • Create a file, like “killfirefox.txt” on your desktop or somewhere handy
  • Paste this into it:
  • You’ll want to make sure you put in your user account name in the path, and delete the “Your User…” holder text
  • Your path to firefox.exe, as listed above, might also be in a different place. You’ll have to find it and confirm.
  • Rename the file extension from “.txt” to “.bat”
  • Double click your new .bat file and voila!
  • Make a shortcut and drag to your quick links bar, or some other handy place

Firefox Memory Leak 2020

So you have a better way to do this?

Save your negative comments for the comments section on msnbc.com. In the meantime, post instructions on a better way. For example, how to do this in AppleScript so you end up with a real “app” you can put in the Dock in a nice way.

Any other thoughts? Let’s here them!

edited April 2015 in Priority support

after using :
DTInstances.getLast().then(function (dtInstance) {
dtInstance.DataTable.rows().invalidate().draw(false);
});
to apply sort, IE and Firefox crash after period of time and when checking memory for IE and Firefox, memory increasing

please, check the following URLs for images contain memory progress in ie :

http://54.191.119.153:8080/static/ie-21.png
http://54.191.119.153:8080/static/ie-22.png

«12»

Firefox Memory Leak Windows 10

Replies

Firefox Memory Leak Windows 10

  • Posts: 52,889Questions: 1Answers: 8,129Site admin

    Hi,

    Are you using the latest version of FixedColumns (per the discussion in your other thread) when doing this test? The current release will unfortunately have a memory leak as it isn't releasing all of its event handlers.

    Regards,
    Allan

  • i am testing on fixedColumns v3.0.4 and before that and now testing in fixedColumns v3.0.5 all have the same issue
    please, i need to know which release contain the fix of this issue and when????

  • Posts: 52,889Questions: 1Answers: 8,129Site admin

    If the latest FixedColumns didn't fix the issue, this is unfortunately likely to be quite difficult to debug. I will get back to you when I have more information.

    Regards,
    Allan

  • please, i need to fix this issue my app force close in Firefox and IE
    i have updates every 2000 update per second
    this issue not acceptable for my environment

  • Posts: 52,889Questions: 1Answers: 8,129Site admin

    2000 updates per second?! That's a lot!

    I'm still looking into what is causing this issue I'm afraid. However, with that many updates per second, the workaround we came up with in one of your other threads to invalidate the whole table on each update is not a good one. I will also need to spend some time looking into your code to suggest a more efficient way of doing it.

    I'll reply back when I have more information.

    Allan

  • Posts: 52,889Questions: 1Answers: 8,129Site admin

    Another update - I'm quite certain that the issue is in FixedColumns and I'm reasonably sure that it is to do with how FixedColumns is cloning the header cells from the original DataTable for display in the fixed columns. It will copy all of the header cells, but not all are displayed, which means they don't have their event handlers removed when they are destroyed.

    How exactly to correct that is something I am still working on.

    Regards,
    Allan

  • Posts: 52,889Questions: 1Answers: 8,129Site admin

    I've just committed a couple of fixes for memory leaks in FixedColumns that should address the leak you are seeing here. Could you try using the nightly version of FixedColumns please? The build date is '23rd Apr 2015, 15:34'.

    Thanks,
    Allan

  • Thanks for reply
    i admit memory leaks reduced but still exist memory leaks
    my memory leaks test : http://54.191.119.153:8080/static/performance.png

  • Posts: 52,889Questions: 1Answers: 8,129Site admin

    Could you possibly update your static/grid.html page with the latest code and I'll take a further look into what is happening.

    Memory is always difficult!

    Thanks,
    Allan

  • updated : http://54.191.119.153:8080/static/grid.html

  • edited April 2015

    I have big another Big issue when hide same columns and reorder columns they back all to show columns can you test it in http://54.191.119.153:8080/static/grid.html just try to reorder with column with auto sort

  • Posts: 52,889Questions: 1Answers: 8,129Site admin

    Thanks for the update.

    It would appear that there are three areas in the FixedColumns code where events are being cloned from the source DataTable (for example the click to sort on column header event) which are not being removed when the table is being fully redrawn each time. I will continue to look into this and let you know how I get on.

    Regarding the column reordering issue - I suspect that at least part of the issue will be with the rapid updating of the data. Unfortunately the support credits have run out now so I won't be able to look into this immediately (I'm actually not sure that there is a possible fix for this one), but I will continue to look into the memory issue as priority support and hopefully get back to you soon.

    Regards,
    Allan

  • Posts: 52,889Questions: 1Answers: 8,129Site admin

    Hi,

    I've just committed an update for FixedColumns that corrects the memory issue that can be seen in your demo. Thanks again for putting that up!

    The latest FixedColumns nightly contains the fix and running your demo locally shows its memory use remaining stable.

    Regarding the column visibility, I had a little look at this. It appears to be caused by a listener that the Angular DataTables code adds that will destroy the DataTable when ColReorder has finished its reordering. The whole lot is then recreated, but with the original column visibility applied. What is interesting is that this isn't 100% reproducible - sometimes I need to try it a couple of times to trigger the error. It might be worth asking in the angular-datatables repo issues about this one as I'm afraid I have no knowledge of Angular myself.

    Regards,
    Allan

  • edited June 2015

    Hi,
    i sent to you before about problem in fixed column and you sent new version, but i still have big performance issue make my app very slow because of memory leak
    and when disabling fixed column, no memory leak happened
    i attached links for testing for memory leak with fixed column and without it :

    and i have url for you to test the problem :

    username : mai002
    password : kn123456

    please click on refresh icon (in black square in attached image) more than one time to see the memory leak issue

  • Posts: 52,889Questions: 1Answers: 8,129Site admin

    Thanks for the update. Unfortunately I'm not managed to get the time to take a look into this yet. I will try to do so as soon as possible.

    Allan

  • Hi Allan,
    we are in closer phase of project and this is very critical for us

  • Hi Allan,
    i want ask you if we renew our support, you can help us to fix this issue

  • Posts: 52,889Questions: 1Answers: 8,129Site admin

    Hi,

    Yes, that would certainly allow me to prioritise this work over the other work that I am doing. I hope to look at this later this week even if you don't renew the support option. But purchasing support would make certain of it, and it would be done sooner rather than later.

    Regards,
    Allan

  • Hi,
    i purchased support, please we need your priority in this issue

  • Posts: 52,889Questions: 1Answers: 8,129Site admin

    Fantastic - thanks. I'm looking into this just now and will get back to you as soon as possible.

    Regards,
    Allan

  • Posts: 52,889Questions: 1Answers: 8,129Site admin

    I sent an e-mail a little while ago, it is possible it didn't get through so I'm posting here as well just in case!

    The links above does appear to be working at the moment. Could you possibly give me an updated link or bring the server back online so I can do a little bit of testing with your pages.

    Thanks,
    Allan

  • Posts: 52,889Questions: 1Answers: 8,129Site admin

    Great - thanks.

    Sorry to ask for one more thing - it appears the websocket that is being used is not resolving:

    ws://dev-dummy:61614/stomp' failed: Error in connection establishment: net::ERR_NAME_NOT_RESOLVED

    Unfortunately I'm struggling to reproduce the issue at the moment, so I thin I will need to be able to use your page to recreate the problem for diagnosis.

    Regards,
    Allan

  • Posts: 52,889Questions: 1Answers: 8,129Site admin

    That's excellent - thank you.

    Could you confirm if I need to perform some action such as toggling table sorting, or tabs or something else to cause the memory leak to appear? I've just been running a memory trace in IE for the last 3 minutes and it is holding at a fairly static value.

    Many thanks,
    Allan

  • Allan,
    over on the header that write on it orders details and you can find refresh button please click on it many times i set between in black square
    you can find it in this image http://kncairo.kn-it.org:8087/Etrade-Plus/resources/fixedColumn.jpg

  • Posts: 52,889Questions: 1Answers: 8,129Site admin

    Fantastic - thanks for pointing that out! I've just been debugging this and I'm fairly certain that it is a conflict between DataTables an Angular when destroying a table - the way DataTables operates means that the Angular destroy method on the nodes doesn't occur, which results in an event being retained - hence the issue.

    I'm going to experiment a little bit more before committing the change required in DataTables. I'll do this first thing tomorrow morning and get back to you then. Hopefully that will resolve the issue!

    Allan

  • Posts: 52,889Questions: 1Answers: 8,129Site admin

    I've just committed the fix that I think is required to address this. I'm not able to test this directly on your system of course so it is possible that I've not fully fixed the issue, but I am hopeful that it will address it fully.

    To test, if you could try using the 1.10.8-dev version of DataTables on your page, that would be great.

    Many thanks,
    Allan

  • Hi Allan,
    i put the file DataTables 1.10.8-dev, and tell me if you need to change any others files

  • Posts: 52,889Questions: 1Answers: 8,129Site admin

    Thank you - unfortunately that doesn't appear to have fixed the issue after all. There is still an Angular hook somewhere that it causing the leak.

    The site runs exceptionally slowly on my machine making debugging it really difficult, so I'll need to spend a bit of time trying to recreate the issue locally and debug further. I'll get back to you when I have some more information.

    Thanks,
    Allan