Jump to content

Cleanup in a one-page app (or how to destroy pixi then reinstantiate it)


drskullster
 Share

Recommended Posts

Hi,

I'm using pixijs in a one-page app. I would like to clean up pixijs references when user changes route, but still be able to reinstantiate it if user comes back. 

I've seen some posts about pixijs cleanup but either :

- I only remove stage children and my memory consumption keeps going up each time I reinstantiate a PIXI.Application
- I use `app.destroy()` but after a new PIXI.Application `app.renderer` is undefined
- I use `app.stage.destroy()` and `app.renderer.destroy()` and I have an issue with Textures

Any idea on the best way to achieve this ?

Link to comment
Share on other sites

14 hours ago, ivan.popelyshev said:

did you look at lingering objects in heap? May be something like "app.loader.reset()" or "PIXI.utils.destroyTextureCache()" is missing 

we have no guides on how to do that => its your job to find it and make an article. Welcome to open-source. 

 

Thanks for your answer. If I destroy the textures and reset the loader, I'm not able to re-instantiate the app, I get an error when pixi is trying to get textures.

I guess my question is: is it possible ? Does Pixi handle this particular case of re-instantiating an app after destroy ?

I'd be happy to add stuff to the github wiki pages if I manage to do that properly.

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