为什么Chrome最终会抛出“内存不足:wasm内存"的错误消息?反复刷新使用WebAssembly的页面后? [英] Why does Chrome eventually throw "Out of memory: wasm memory" after repeatedly refreshing a page that uses WebAssembly?

查看:3267
本文介绍了为什么Chrome最终会抛出“内存不足:wasm内存"的错误消息?反复刷新使用WebAssembly的页面后?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想相信刷新浏览器窗口或标签不会泄漏.不幸的是,当涉及WebAssembly时,情况似乎并非如此.

I would like to believe that refreshing a browser window or tab cannot leak. Unfortunately, this does not appear to be the case when WebAssembly is concerned.

我用Rust构建了一个WebAssembly板条箱.板条箱的编译大小约为360 Kb(在内容压缩之前),板条箱在Firefox甚至iOS的Safari上也能正常工作.但是,我在Chrome中遇到了很多问题,其中之一就是刷新使用.wasm的页面最终会导致控制台中出现内存不足错误.

I have built a WebAssembly crate with Rust. The compiled size of the crate is approximately 360 Kb (prior to content compression) and the crate works just fine in Firefox and even on Safari on iOS. However, I am having numerous issues in Chrome, one of them being that refreshing the page that uses the .wasm eventually leads to an out-of-memory error in the Console.

该页面正常工作约35次刷新,然后抛出以下内容:

The page works fine for about 35 refreshes and then throws the following:

Uncaught (in promise) RangeError: WebAssembly Instantiation: Out of memory: wasm memory

此后,该选项卡无用,但是打开新选项卡并加载页面按预期工作-再次,大约前35次刷新.

After this, the tab is useless but opening a new tab and loading the page works as expected -- again, for about the first 35 refreshes.

这是浏览器中的错误还是我的代码有误?如果是错误,是否有任何解决方法? (并不是我希望它会在生产中体现出来,但是无论如何……)

Is this a bug in the browser or am I doing something wrong in my code? If it is a bug, is there any way to work around it? (Not that I expect that it will manifest itself in production but anyway...)

(大概,错误消息中提到的诺言是import('...')返回的诺言.我正在使用webpack,因此受到

(Presumably, the promise mentioned in the error message is the one returned by import('...'). I am using webpack and so I am affected by https://github.com/webpack/webpack/issues/6615 )

推荐答案

这显然是Chrome中已确认的错误:

This is apparently a confirmed bug in Chrome: https://bugs.chromium.org/p/chromium/issues/detail?id=935169

仅在打开Chrome开发人员工具时发生.

It only occurs when Chrome's developer tools are open.

这篇关于为什么Chrome最终会抛出“内存不足:wasm内存"的错误消息?反复刷新使用WebAssembly的页面后?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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