soylomass Posted March 30, 2017 Share Posted March 30, 2017 It's me again. I have a problem with my game. Whenever a user changes server, I recreate the game (because otherwise I should reset a lot of things) using: game.state.start(game.state.current, true, false, host); It works fine, but each time I do this, the memory grows a lot. I've checked the memory profiler of Chrome Console, and I see that there are a lot of big BitmapData inside CanvasPool, which explain most of the used memory: Is there any way to avoid this? It causes crashes in low memory devices (like most mobile phones). Thanks in advance. Link to comment Share on other sites More sharing options...
soylomass Posted March 30, 2017 Author Share Posted March 30, 2017 As a workaround, I'm emptying the CanvasPool before restarting the stage: while(PIXI.CanvasPool.pool.length > 0) { let elem = PIXI.CanvasPool.pool.pop(); elem.parentNode = null; elem = null; } Link to comment Share on other sites More sharing options...
samme Posted March 30, 2017 Share Posted March 30, 2017 Are you creating BitmapDatas or RenderTextures? You can destroy them when restarting the state. Link to comment Share on other sites More sharing options...
soylomass Posted March 31, 2017 Author Share Posted March 31, 2017 3 hours ago, samme said: Are you creating BitmapDatas or RenderTextures? You can destroy them when restarting the state. I am, actually, but didn't destroy them manually. I thought they would be destroyed when restarting the state I'll try that. Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts