Jump to content

Find all renderers and stages on global PIXI


Richacinas
 Share

Recommended Posts

Hello there,

 

I'm trying without success to find all stages and renderers that PIXI has in memory, so I can call destroy on them and their children.

 

I'm sure there is a way to have that so I don't have to keep track on my application. It is a React website and therefore the component that had that reference is unmounted and then mounted again later on. When I instantiate a new stage and renderer, I can see them piling up and using a lot of memory as I go from one part of my website to another.


How could I find all instances so I destroy them before creating new ones? I have the global PIXI object on window...

 

Thanks a lot!

Link to comment
Share on other sites

PIXI has texture cache (PIXI.utils.textureCache and baseTextureCache), so you can find textures that were't destroyed. There are no caches for renderers, its up to you to store them somewhere..

Stage elements do have no bound webgl resources, so its ok to ignore it and just wait when javascript GC takes care of them.

I recommend to re-use canvases and webgl renderers, and make sure that number of active renderers is small, there's a limit on that in browsers.

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.

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

Loading...
 Share

  • Recently Browsing   0 members

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