Sahil Posted December 16, 2019 Share Posted December 16, 2019 (edited) I am using 150-250 sprites of size 1920x1080 in animated sprite. There are four stages, whenever I don't need a stage I destroy animated sprite and base textures for it. Memory does get released after some time but I was curious if I am doing something wrong apart from using too large and too many images. Following is how I am destroying everything, stage.removeChild(videoSprite); videoSprite.destroy({ children: true, texture: true, baseTexture: true }); videoSprite = null; for (var i = 0; i < textureArray.length; i++) { var texture = textureArray[i]; texture.destroy(true); } textureArray = null; PIXI.utils.clearTextureCache(); Anything I am doing wrong or can do to release memory faster? Edited December 16, 2019 by Sahil Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted December 16, 2019 Share Posted December 16, 2019 "texture.destroy(true)" should work, yep. In ase you forgot to free something, pixi will automatically remove object from videomemory in a minute or two. You can place breakpoint here or add "console.log" to see if GC is triggered: https://github.com/pixijs/pixi.js/blob/dev/packages/core/src/textures/TextureGCSystem.js#L103 Sahil 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.