Jquery 内存不足错误-找不到原因

Jquery 内存不足错误-找不到原因,jquery,loops,Jquery,Loops,我有这个代码是很久以前从这里的提示 var tm var tn; var rot = true; var rot2 = true; var th = 482; var tmh = 0; var $paneTarget = $('#lyr1'); var slideshow = { delay: 5000, actions:[], run: function() { if (slideshow.actions.length) { v

我有这个代码是很久以前从这里的提示

var tm
var tn;
var rot = true;
var rot2 = true;
var th = 482;
var tmh = 0;
var $paneTarget = $('#lyr1');

var slideshow = {
    delay: 5000,
    actions:[],
    run: function() {
        if (slideshow.actions.length) {
            var current = slideshow.actions.shift(); 
            current(); 
            slideshow.actions.push( current ); 
            tm = setTimeout(slideshow.run, slideshow.delay); 
        }
    },
    play: function(n) {
        if (n!=true)
            $(document).clearQueue();
        if (slideshow.actions.length) {
            tm = setTimeout(slideshow.run, slideshow.delay); 
        }
    },
    pause: function() {
        clearTimeout(tm);
        $(document).clearQueue();
    }
};

$(".sideimg").each(function(){
    var that = this;
    slideshow.actions.push(function(){
        if (tn != "") {
            out(tn);
        **}**
        over($(that).attr("id"));
        n = $(that).attr("id").substring($(that).attr("id").indexOf("img")+3,$(that).attr("id").length)
        info("image.asp?id="+n+"","info");
        var $target = $paneTarget.find('#'+$(that).attr("id"));
        var timg = document.getElementById($(that).attr("id"));
        if (timg.offsetTop>th||timg.offsetTop+timg.height>th||timg.offsetTop<tmh) {
            $paneTarget.stop().scrollTo( $target , 800 );

            tmh = timg.offsetTop;
        }
        $("#rimg").fadeOut("slow",function () {
            slideshow.pause;
            $("#rimg").attr("src",$(that).attr("bsrc")).load(function(){
                $("#rimg").attr("alt",$(that).attr("alt"));
                $("#rimg").fadeIn("normal");
                slideshow.play;
            });

        });
        tn = $(that).attr("id");
    });
});
错误是:第37行内存不足 该行为粗体}粗体不起作用,因为它位于代码行内,所以请查找**}**

它不会在第一个循环或第二个循环后出现-它需要很长时间才能出现。。。也许20分钟

我把它放进去了(我收到消息了。。。它是镀铬的,看起来还可以。。。使用firebug在FF中查看DOM,但一小时后没有错误

我真的不知道该怎么办


更新-我使用的是jquery 1.4.1,在22-23分钟的循环之后,错误出现在jquery库中,我仍然不知道该怎么做理想情况下,代码分配的所有对象都应该由JS垃圾收集器正确地释放。但是,不同浏览器上的垃圾收集实现之间存在差异,这可以解释为什么您只在IE中看到此错误

特别是,我知道在早期版本的IE6及以下版本中至少有一个bug,不知道它是否存在于7+版本中,其中包含循环引用的对象未被正确收集,从而导致内存泄漏。我怀疑您遇到的不是这个特定的bug,就是类似的东西

不幸的是,我没有一个简单的解决方案给你;您可能需要重新构造代码以避免内存泄漏。

我看到的问题:

slideshow.pause;
slideshow.play;
应该是

slideshow.pause();
slideshow.play();
n未定义:无论您想用它定义什么,请在正确的范围内定义它


最后我不知道到底发生了什么;是显示html还是完整页面?我现在在yahoo.co.uk,名字是: