图片加载多次,这是 Firefox 还是 NivoSlider bug?
当我打开两个选项卡,每个选项卡中都包含 Nivo Slider 时,我观察到 Firebug 的网络选项卡在每次幻灯片更改中显示同一图像的多个请求。它增加了 firefox.exe 的页面大小(以 mb 为单位)和内存使用/分配。一段时间后,我的电脑变得非常慢,任务监视器中的内存分配高于1GB。
如何复制它: 1- 在 Firefox 中的 2 个选项卡中打开 http://nivo.dev7studios.com/(在 3.6 中测试~ 5.0) 2-在第二个选项卡中打开firebug的网络面板 3-重新加载第二个选项卡
When I open two tabs with Nivo Slider in each one, I observed that firebug's net tab show multiple requisitions of the same image in each slide change. It grow the size(in mb) of the page and memory usage/allocation to firefox.exe. After a while, my computer became very slow, and memory allocation in task monitor is higher than 1gb.
How to replicate it:
1- Open http://nivo.dev7studios.com/ in 2 tabs in firefox(tested in 3.6 ~ 5.0)
2- Open net panel of firebug in the second tab
3- reload the second tab
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我刚刚在 FF 3.6 中进行了测试 - 同样的问题。
查看文件 http://nivo.dev7studios.com/scripts /nivo-slider/jquery.nivo.slider.js : 84
还有第 253、262、284 行等。它会动态添加背景图像,因此浏览器应该一次又一次地请求它。幸运的是,服务器响应标头 304 Not Modified。
答案是:NivoSlider。
I've just tested in FF 3.6 - the same issue.
Look at the file http://nivo.dev7studios.com/scripts/nivo-slider/jquery.nivo.slider.js : 84
Also lines 253, 262, 284 etc. It adds background image on-the-fly, so the browser should request it again and again. Fortunately the server responds with header 304 Not modified.
The answer is: NivoSlider.
我在 FF 4.0.1 中打开一个选项卡时出现内存泄漏。
Chrome (12.0.742.100) 也是如此,尽管没有 FF 那么糟糕。
看来 NivoSlider 导致了这次泄漏。
I am getting memory leaks in FF 4.0.1 with one tab open.
Chrome (12.0.742.100) too, although not as bad as FF.
Seems like NivoSlider is causing this leak.
我们在工作中对此进行了测试,首先我们看到 Firefox 重新下载图像,正如原始海报所说。但后来我们意识到,如果您从未使用 Firefox/Firebug 工具将鼠标悬停在图像上,它就永远不会重新下载图像!
换句话说,由于滑块的原因,这似乎不会发生。看起来只有当您开始使用 Firefox/Firebug 进行调查时才会发生这种情况。
所以我认为这不是问题。
We were testing this at my job, and at first we saw Firefox re-downloading images, just as the original poster said. But then we realized something-- if you never hover over the images using Firefox's/Firebug's tool, it never redownloads the images!
So in other words, it looks like this isn't happening because of the slider. It looks like it only happens when you start investigating using Firefox/Firebug.
So I don't think this is a problem.
我也遇到同样的问题,内存泄漏。
看来nivo毕竟不是那么好。
经过一番尝试后,我设法显着降低了负载,至少根据萤火虫的说法是这样。
我做了两件事:
问题仍然没有完全解决,我得到一些奇怪的行为。
我只有4张照片。它们都在启动时加载。在某些时刻(我不知道原因,通常是第一次显示图像时)再次加载 2 张图片(从缓存)。之后,它工作正常。我把它打开一个小时,没有新的负载。
总之,通过上述更改,我获得了 2 个额外负载。与我之前的相比(每当图像更改时都会加载新负载),它还不错。
我仍然找不到这种行为的原因或解释。也许 Firefox 会释放一些内存,以便图像时不时地重新加载?
I'm having the same problem with memory leaks.
Looks like nivo isn't so great after all.
After some trying out I managed to lower the load significantly, at least according to firebug.
I did two things:
The problem is still not entirely fixed, I get some strange behavior.
I have just 4 pictures. They all get loaded on start. In some moment (I don't know the reason, usually first time the image is show) 2 pictures get loaded again (from cache). After that, it works fine. I left it opened for an hour, no new loads.
So in conclusion, with the mentioned changes I get 2 extra loads. Compared with what I had before (new load whenever a image is changed) its not so bad.
I still can't find the reason or the explanation for this behavior. Maybe firefox frees some memory along the way so the images get loaded again from time to time?