Jump to content

Leftovers after cleanup


Wardzr
 Share

Recommended Posts

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 by Wardzr
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 by Wardzr
Link to comment
Share on other sites

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

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