Profiling and managing memory

Good afternoon guys,

I’m having some problems with memory management while dealing with images and textures. Unloading them simply don’t free any memory and bigger textures are not consuming more space.

https://playcanvas.com/project/703793/overview/texture-unload

This example project simply loads 10 textures at a specified size and store them as assets, then is possible to iterate the textures by console commands.

TextureManager.nextTexture() : Apply the next texture
TextureManager.unloadAll() : Unload all assets
TextureManager.reloadAll() : Reload all textures

As the image above shows, the memory is not even affected by images.

Someone knows how can i debug properly the memory used by textures? I already used the profiler, memory snapshots, searched for Texture and Assets objects and nothing seems to help me.

Hi @derickwelman,

The browser dev tools I think can’t track the VRAM usage, which is different from the memory allocated by the Javascript runtime.

You can track the memory used by models, textures etc using the Playcanvas profiler (ALT + T). Running your methods properly allocates memory and then releases everything (check VRAM textures total):

1 Like

Good evening @Leonidas,

I already tried the profiler, but didn’t noticed that it was able to scroll down :man_facepalming:

Thanks for the help!!

1 Like

I tackled a similar problem 2 weeks ago, maybe my post can help you a bit :wink:

1 Like