如何在 Firefox 中跟踪和调试 JavaScript 内存泄漏? [英] How do I track and debug JavaScript memory leaks in Firefox?

查看:39
本文介绍了如何在 Firefox 中跟踪和调试 JavaScript 内存泄漏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试跟踪这个一个月了,但没有任何成功.我在一个汽车广告网站上有一段代码,它基本上允许缩略图在搜索结果中旋转,因为一辆车有多个图片.您可以在以下位置看到它的实际效果:

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 to rotate in search results given that a car has multiple pictures. You can see it in action at the following:

http://www.abcavendre.com/4506691919/

它建立在 mootools 1.2 框架之上.问题是这个脚本,在Firefox 3下,当页面充满那些旋转的图片时,会消耗相当多的内存超时,例如这个库存页面:

It is built on the mootools 1.2 framework. The problem is that this script, under Firefox 3, consumes a rather large amount of memory overtime when a page is full of those rotating pictures, such as this inventory page:

http://www.abcavendre.com/Vitrine/Israel_Huttman/

您可以在此处查看相关脚本的来源:

You can see the source of the script in question here:

http://www.abcavendre.com/scripts/showcase_small.js

关于是什么导致内存泄漏的任何想法?奇怪的是这段代码在 IE7 下运行正常.

Any ideas as to what is causing the memory leak? The weird thing is this code behaves properly under IE7.

推荐答案

在 Firefox 中跟踪内存泄漏的一种方法是使用 泄漏监控插件.它显示了 javascript(包括扩展脚本)的内存泄漏.

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.

这篇关于如何在 Firefox 中跟踪和调试 JavaScript 内存泄漏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆