unity-game-engine - Chrome 中每个页面加载时堆内存都会增加

标签 unity-game-engine unity-webgl

我是getting aw snap or sometimes not enough memory problem when I reload my WebGL page 。我有一个空的 WebGL 项目(只有一个相机+灯光),是在 unity3d 中开发的。我正在重新加载它,并分析它的内存。 enter image description here

正如您所看到的,第一次加载时加载了 1.2MB,第二次加载时加载了 1281 MB,然后是 1574 MB,然后是 2160 MB,然后崩溃了。我很惊讶为什么会发生这种情况?

我搜索并found那个

最佳答案

Unity 研究员之一 told当浏览器 Dev Tool 打开时,每个页面重新加载都会增加内存: ”

One point to note is that when profiling memory usage on page reloads in Firefox, make sure to have the Firefox web console (and debugger) window closed. Firefox has a behavior that if web console is open, it keeps the Firefox JS debugger alive, which pins all visited pages to be cached in memory, never reclaiming them. Closing the Firefox web page console allows freeing the old pages from memory

但是

我的测试表明,对于 Chrome 是这样,但对于 Firefox 则不然。无论您的开发工具打开还是关闭,Firefox 都会在每次页面重新加载时增加内存。

但是我的问题在 chrome 中解决了(在 firefox 上仍然存在问题?我猜这是浏览器的默认行为),关闭开发工具后,chrome 上的内存不会增加。

关于unity-game-engine - Chrome 中每个页面加载时堆内存都会增加,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55195940/

相关文章:

javascript - Unity 3D WebGL : Run Javascript code after the app has been loaded and is ready

c# - Unity 测试工具使用 GameObject 进行单元测试给出 "You are trying to create a MonoBehaviour using the ' new' 关键字。这是不允许的。”

java - Android 和 Unity3D - Unity 生成的 R.java?

javascript - 将回调从 Unity 传递到 JavaScript,然后返回到 Unity

browser - WebGL - 在新选项卡中打开 URL?

c# - 如何通过 Unity 使用 WebGL/C# 在新选项卡上打开链接?

android - 加载图像时 Unity 应用程序崩溃

unity-game-engine - 如何将游戏对象的变换位置传递给我的 CG 着色器?

c# - 最新版本的 Unity 和 Google 无法生成 APK 构建并显示 Android Manifestation 脚本错误

unity-game-engine - 隐藏的Unity WebGL应用程序: "Screen position out of view frustum"