just another web log

13 Aug 2014:
JavaScript memory leak in firefox X
The lack of updates can be attributed to the following...

I have an interesting problem and it requires three things to be in alignment. Unfortunately for me they are all in alignment on my machine, this machine.

There is an old Java applet currently sitting on my home page and I had decided that to upgrade the look of the front page I would re-write this in JavaScript. I have almost finished but while doing the final tweaks I left the animation running all day. In fact a day and half and then I find what looks like Linux crashed. Except, it is not dead, just stunned. "Out of memory" which is odd, Linux never gives me any problems. So reboot check everything and go about my business then it happens again. This time I go hunting, shutting down everything and running top to monitor memory usage.
(SHIFT+M) to order by memory

Except it does not go up. Thinking it was just a fluke I get on with my code again, this time leaving it overnight. In the morning top shows that "X" has consumed 78% of memory and when I had left it the previous night it was just 8%. Still not believing its my code I shutdown everything in X checking the memory as I go. Firefox is the first to go, but the memory percentage does not go down. I have closed everything visible and running the background and still X stubbornly holds 78% of memory.

This time after the machine is recovered I run nothing that leave it over night, no excess memory usage. It is something I am doing with X. Try a few things, even forcing Firefox to load lots of YouTube videos, not a blip. Then try my code, nothing obvious, wait, it just went up 0.1%, not Firefox but X. Twenty minutes later and there is a 2% increase, so I kill Firefox but the memory percent does not go down. Trying anything else in Firefox still no problem, my code same slow drip of 0.1% memory usage.

Wow! My code is that bad? No, the code works fine in Firefox or Chrome in Windows and the Chrome heap diagnostics tools show my code does nothing memory hungry or leaky.

I also spent sometime looking for ways to improve my code regarding memory leaks and the only areas I could find reasonable updates were not in the main loop and were only called once.

Next job rebuild the kernel(I have been putting it off for a while) and hope that and the phase of the moon resolves it so I can get on and finish this code so I can move onto refactoring the jumpstation home page(long time coming).
loading results, please wait loading animateloading animateloading animate
[More tags]
rss feed



flog archives

Disclaimer: This page is by me for me, if you are not me then please be aware of the following
I am not responsible for anything that works or does not work including files and pages made available at www.jumpstation.co.uk I am also not responsible for any information(or what you or others do with it) available at www.jumpstation.co.uk In fact I'm not responsible for anything ever, so there!

[Pay4Foss banner long]