Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak when using preFX in the same scene as a 3.8 Spine object #6856

Open
Bambosh opened this issue Jul 7, 2024 · 2 comments
Open

Comments

@Bambosh
Copy link
Contributor

Bambosh commented Jul 7, 2024

Version

  • Phaser Version: 3.80.1
  • Operating system: Windows
  • Browser: All browsers

Description

If you assign preFX to any gameObject in a scene that also contains a 3.8 spine object, something goes wacky in the renderer and starts spewing the same instructions into this.renderer.glAttribLocationWrappers on repeat.
Game performance eventually tanks, as renderer.glAttribLocationWrappers.indexOf() is run multiple times per render cycle.

Example Test Code

Click the text to trigger the bug
https://codepen.io/Bambosh/pen/KKjKdxP

Additional Information

Copy link

greptile-apps bot commented Jul 7, 2024

For internal use only

To address the memory leak issue in Phaser 3.80.1, please check the following updates and fixes:

  1. DynamicTexture: Ensure setSize(width, height) is called for both WebGL and Canvas. This prevents width and height from being set to -1 in Canvas mode.

    DynamicTexture.setSize(width, height);
  2. DynamicTexture: Check if the glTexture bound to the current frame is stale and destroy it before binding the one from the Render Target to prevent memory leaks.

    if (this.glTextureIsStale) {
        this.destroyGLTexture();
        this.bindRenderTargetTexture();
    }

Refer to the changelog for version 3.80.1 for more details on these fixes.

References

/changelog/3.80.1/CHANGELOG-v3.80.1.md
/changelog/3.80/CHANGELOG-v3.80.md

About Greptile

This response provides a starting point for your research, not a precise solution.

Help us improve! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

Ask Greptile · Edit Issue Bot Settings

@Bambosh Bambosh changed the title Memory leak with Memory leak when using preFX in the same scene as a 3.8 Spine object Jul 7, 2024
@Scross086
Copy link

I see this with later versions of spine as well. If you use preFX and spine in the same scene, a significant memory leak begins. I'm using spine 4.1 I think

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants