Jump to content

Event listeners causing Memory Leaks


Recommended Posts



I tried Phaser 3.13 to resolve the issue with 'shutdown' listeners memory leaks, but it's like a magic - the objects appear in 'shutdown' array even in the 3.13 version!

Another similar problem is 'remove' listeners stays in AnimationManager after destroying the Sprite or restarting the whole scene, it also causes memory leaks.

What am I doing wrong?

Link to comment
Share on other sites


They absolutely don't add themselves to the shutdown event any longer. This is a Scene in 3.13 with 91 Images on the display list:


and here is the same Scene in 3.12:


The shutdown event has 91 less entries in it in 3.13, exactly as it should do.

Link to comment
Share on other sites

Thanks for the answer!

You're right about the 'shutdown' listener. I've checked this, but my work project says the opposite. And I've found the source of bug. Could you try to create a Container with a Sprite inside, and then invoke destroy() on the Container or Sprite? This is the magic which I talked about, Sprite (and I think all other GameObject's inside the Container) appears inside the shutdown array!

And I can't understand the Animation behaviour. The Animations have destroy() method with "this.animationManager.off('remove', this.destroy, this, true)", but when I'm trying to debug this code while I'm destroying the Sprite, this method never invokes. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...