Skip to content

无论是用enableAutoResize还是用window的resize事件,快速反复地调整页面大小,RenderTargetPool.ts里的2个push()都会导致内存溢出问题 #3046

Description

@luo2430

Describe the bug

无论是用enableAutoResize还是用window的resize事件,快速反复地调整页面大小,RenderTargetPool.ts里的2个push()都会导致内存溢出问题,报错如下:

GLRenderTarget.ts:329 Uncaught Error: The format of the attachment is not supported or if depth and stencil attachments are not the same renderbuffer
    at GLRenderTarget._checkFrameBuffer (GLRenderTarget.ts:329:17)
    at GLRenderTarget._bindMSAAFBO (GLRenderTarget.ts:290:10)
    at new GLRenderTarget (GLRenderTarget.ts:86:12)
    at WebGLGraphicDevice.createPlatformRenderTarget (WebGLGraphicDevice.ts:265:12)
    at new RenderTarget (RenderTarget.ts:222:59)
    at RenderTargetPool.allocateRenderTarget (RenderTargetPool.ts:80:22)
    at PipelineUtils.recreateRenderTargetIfNeeded (PipelineUtils.ts:109:37)
    at BasicRenderPipeline.render (BasicRenderPipeline.ts:167:49)
    at Camera.render (Camera.ts:681:26)
    at uiCanvas (Engine.ts:586:22)
_checkFrameBuffer @ GLRenderTarget.ts:329
_bindMSAAFBO @ GLRenderTarget.ts:290
GLRenderTarget @ GLRenderTarget.ts:86
createPlatformRenderTarget @ WebGLGraphicDevice.ts:265
RenderTarget @ RenderTarget.ts:222
allocateRenderTarget @ RenderTargetPool.ts:80
recreateRenderTargetIfNeeded @ PipelineUtils.ts:109
render @ BasicRenderPipeline.ts:167
render @ Camera.ts:681
(匿名) @ Engine.ts:586
forEach @ DisorderedArray.ts:112
(匿名) @ Engine.ts:577
(匿名) @ Engine.ts:567
update @ Engine.ts:383
update @ WebGLEngine.ts:97
(匿名) @ Engine.ts:145
requestAnimationFrame
(匿名) @ Engine.ts:143
requestAnimationFrame
(匿名) @ Engine.ts:143
requestAnimationFrame
(匿名) @ Engine.ts:143
(省略大量相同)
requestAnimationFrame
(匿名) @ Engine.ts:143
requestAnimationFrame
(匿名) @ Engine.ts:143
requestAnimationFrame
(匿名) @ Engine.ts:143
(匿名) @ Engine.ts:143
requestAnimationFrame
(匿名) @ Engine.ts:143
requestAnimationFrame
(匿名) @ Engine.ts:143
requestAnimationFrame
(匿名) @ Engine.ts:143
(匿名) @ Engine.ts:143
device-restore.html:1 WebGL: CONTEXT_LOST_WEBGL: loseContext: context lost
Engine.ts:673 Device lost.
WebGL: INVALID_OPERATION: delete: object does not belong to this context
WebGL: INVALID_OPERATION: delete: object does not belong to this context
WebGL: INVALID_OPERATION: delete: object does not belong to this context
WebGL: INVALID_OPERATION: delete: object does not belong to this context
WebGL: INVALID_OPERATION: delete: object does not belong to this context
Engine.ts:688 Graphic resource restored.
Engine.ts:694 Graphic resource content restored.

Device restored.

To Reproduce

  1. device-restore.ts 中用window resize事件或enableAutoResize来自动调整大小
  2. 打开 Device restore
  3. 进入开发人员工具
  4. 反复调整大小

Expected behavior

不内存泄漏。

Desktop (please complete the following information):

System:
OS: Windows 11 10.0.26200
CPU: (16) x64 AMD Ryzen 7 4800H with Radeon Graphics
Memory: 3.89 GB / 15.42 GB
Binaries:
Node: 22.23.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.22 - C:\Users\24306\AppData\Roaming\npm\yarn.CMD
npm: 11.17.0 - C:\Program Files\nodejs\npm.CMD
pnpm: 9.3.0 - C:\Users\24306\AppData\Roaming\npm\pnpm.CMD
Managers:
pip3: 26.0.1 - ~\AppData\Local\Programs\Python\Python314\Scripts\pip3.EXE
Utilities:
Git: 2.53.0. - C:\Program Files\Git\cmd\git.EXE
Git LFS: 3.7.1 - C:\Program Files\Git\cmd\git-lfs.EXE
Curl: 8.19.0 - C:\WINDOWS\system32\curl.EXE
SDKs:
Windows SDK:
AllowDevelopmentWithoutDevLicense: Enabled
Versions: 10.0.26100.0
IDEs:
Android Studio: AI-253.29346.138.2531.14876573
VSCode: 1.125.1 - C:\Users\24306\AppData\Local\Programs\Microsoft VS Code\bin\code.CMD
Languages:
Python: 3.14.3 - C:\Users\24306\AppData\Local\Programs\Python\Python314\python.EXE
Browsers:
Edge: Chromium (149.0.4022.80)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions