English 中文(简体)
绘制图像时标本堆叠溢出
原标题:javascript stack overflow while drawing images

我只是将一吨图像(约5000)装入“新图像()”对象,然后通过调用画布.drawimage(图像, 0, 0)在画布中逐一绘制;

这对 IE10 完全有效, 但一旦我使用 Firefox, 我就会有一个堆叠溢出错误, 因为 Firefox 的记忆用法会上升, 直到溢出。 有人知道原因吗? 我认为 GC 在将图像绘制到画布后不会真正收集我的图像。 即使我正在使用100 个图像对象, 并在绘制图像对象之前将图像对象的弧形循环, 记忆用法会上升和上升。 我将很快测试 Chrome 和 Safari, 但还需要一个解决方案, 因为每个人都在使用“ 最佳浏览器 ” Firefox 。

编辑:

function play() {
    //calculated iLag here
    //calculated wondow.FrameCtr here
    var iFrameRate = Math.round(1000 / 25);
    var oImage = new Image();
    oImage.onload = function () {
        renderImage(this);
    }
    //window.Video is an array of window.URL.createObjectURL(data) (about 500 items)
    oImage.src = window.Video[window.FrameCtr];
    oImage = null;
    setTimeout(
            function () {
                play()
            }, iFrameRate - iLag
        );

function renderImage(oImage) {
  $("#video")[0].getContext("2d").drawImage(oImage, 0, 0);
}

I do loop this video (500 items, 25fps) 10 times, and ff isn t even able to play it once, cause of stack overflow. As I mentioned before it is working fine with IE10 and works even better with Chrome, so I don t think the problem here is the recursion. Is there any other way to get binary data into in canvas, than using an Image object and setting the src?

问题回答

在 Firefox 中, 它已经被标记为臭虫 。 您可以看到 < a href=" https:// bugzilla.mozilla. org/ show_ bug. cgi? id= 405584" rel=“ nofollow” > bug 报告中 < / a> 。 它显示的是2010-09-17 最后一次修改的日期, 但我不确定是否在更新版本中解决 。

但我猜新版的Firefox 不应该有这个问题。





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签