How do I track and debug JavaScript memory leaks in Firefox?

前端 未结 3 471
挽巷
挽巷 2020-12-09 10:23

I\'ve been trying to track this one for literally a month now without any success. I have this piece of code on an car advertising website which basically allows thumbnails

相关标签:
3条回答
  • 2020-12-09 11:02

    A way to track memory leaks in Firefox is with the Leak Monitor Addon. It shows memory leaks of javascript (including extension-scripts).

    Please remind that the plugin will sometimes show leaked objects that will get cleaned up later by the garbage collection. If that is the case the plugin will launch a new window showing you the new status.

    0 讨论(0)
  • 2020-12-09 11:06

    Try nulling elements variable array in the end of the initialize function

        ...
    
        if (ads.length > 0)
            {
            this.imagesFx = new Fx.Elements(elements,
                {
                wait: false,
                duration: 1000
                });
            this.moveNext.periodical(2500, this);
            }
    
        elements = null; //Add THIS!
    }
    
    0 讨论(0)
  • 2020-12-09 11:12

    Update to MooTools 1.2.1, we've improved garbage collection and leak handling.

    0 讨论(0)
提交回复
热议问题