Jump to content

Purge unused textures


Recommended Posts

Does phaser have a function to purge unused textures, or if not, how can I manually remove a texture from phaser - for example if I have some textures for the start screen of my game, and some textures for the gameplay section. 


The reason is that on mobile the game is running out of video memory, however it's only because I cannot purge the textures that I am no longer using.

Link to comment
Share on other sites

You would use Cache.removeImage, or Cache.destroy to nuke them all. If you've still got a reference to the image elsewhere then it won't be garbage collected, otherwise that should be enough to nuke it. What I'm thinking of doing in a future version is recycling the Image objects in the Cache, so if you delete one then load a new image it re-uses an existing DOM node. That should help.

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...