Wardzr Posted October 1, 2020 Share Posted October 1, 2020 (edited) I'm trying to figure out cleaning up my app and I've stripped it down to only a scene and the loader preloading all the textures (using prepare). I'm not even adding anything to the scene, just loading assets. I then destroy everything (by cycling through an array containing all my textures and calling .destroy(true) on them then clearing the texture array and calling reset on the loader. I then destroy the scene and remove the view from the DOM. The problem is the memory footprint doesn't go away, and worst of all it still takes a few seconds for the browser to return to the tab after a while due to a prolonged GPU and Paint call (even though there's close to nothing still rendered on the page) Code for loader and cleanup: accumulator.map(asset => { return this.loader.add(this.imagePath+asset+this.computeAssetPostfix())} ); accumulator = []; this.loader.use((res, next) => { // console.log(prepare); if(res.textures) { Object.keys(res.textures).map(key => { prepare.add(res.textures[key]); this.allTextures.push(res.textures[key]); }) prepare.upload(() => { next(); }) } else if (res.texture) { prepare.upload(res.texture, () => { this.allTextures.push(res.texture); next() }); } }) ... unloadAll() { this.allTextures.forEach(texture => { texture.destroy(true); }) this.loader.reset(); this.allTextures =[]; } What am I missing here? The scene is part of a much larger app that's usually very fast to load and I don't want the whole tab and app to be compromised after I display one scene. Edited October 1, 2020 by Wardzr Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted October 1, 2020 Share Posted October 1, 2020 what about pixi application object? how do you use it? Quote Link to comment Share on other sites More sharing options...
Wardzr Posted October 1, 2020 Author Share Posted October 1, 2020 I don't use it at all ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted October 1, 2020 Share Posted October 1, 2020 so you have a ticker or RAF where you registered calls of renderer, right? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted October 1, 2020 Share Posted October 1, 2020 btw, from "res.textures" even one texture is enough to be passed in prepare, they all have same baseTexture, and that's what matters. Unless you use multi-packing feature of texturepacker Quote Link to comment Share on other sites More sharing options...
Wardzr Posted October 1, 2020 Author Share Posted October 1, 2020 Yep I have a custom ticker that I use, but that's not even engaged in the stripped down version. I just create renderer but I don't even render anything, never call render(). As for the textures, I expected that to be the case but I don't think it is. I stepped through the upload a bunch of times and it didn't seem to do anything like it. The effect was also pretty visible, as starting all the animations at once would lag out big time Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted October 1, 2020 Share Posted October 1, 2020 Sorry, I'm not focused enough to understand the problem If you post more data about your issue, or even a demo, it'll be easier for me to advice something Quote Link to comment Share on other sites More sharing options...
Wardzr Posted October 1, 2020 Author Share Posted October 1, 2020 (edited) Actually it's not the loader. It's the renderer itself. I've removed all the assets, the loader, and everything. I've only got and empty container rendered to the DOM and it still does the same... And by that I mean it's still slow to switch to the tab even after i've removed the thing. Edited October 1, 2020 by Wardzr Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted October 1, 2020 Share Posted October 1, 2020 then its shared ticker. switch it off if you dont need AnimatedSprite's and events like "button was moved under the mouse" Quote Link to comment Share on other sites More sharing options...
Wardzr Posted October 1, 2020 Author Share Posted October 1, 2020 Problem is I do need animatedSprite but maybe it can work if I stop it when the users switches tabs. I already pause my own ticker due to chrome's slowdown. Quote Link to comment Share on other sites More sharing options...
Wardzr Posted October 1, 2020 Author Share Posted October 1, 2020 12 minutes ago, ivan.popelyshev said: then its shared ticker. switch it off if you dont need AnimatedSprite's and events like "button was moved under the mouse" nop, didn't work :(. Stopping and starting the ticker on tab switch doesn't improve the switching performance And stopping and destroying the ticker when I want to remove the whole thing doesn't fix it either... Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted October 1, 2020 Share Posted October 1, 2020 oh right, TAB CHANGE, raf doesnt work while tab is different. OK, that's strange, need a demo Quote Link to comment Share on other sites More sharing options...
Wardzr Posted October 1, 2020 Author Share Posted October 1, 2020 I'll try to build one when I get back to work tomorrow. Thanks for the help. 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.