[SOLVED] How to manage GPU memory with Playcanvas? Got crash with when GPU memory is at maximum


I’m working on a product configurator and it’s possible to load (on demand with loadFromUrl) a lot of models and textures. In fact, the user can load 200Mb+ of data with that.

The problem is that my GPU Memory goes high and eventually kill the GPU memory coming form my Google Chrome tab, causing the canvas to not work anymore.

If I reload the page with the canvas, the memory is release.

So, is there a way to manage the GPU memory with Playcanvas? Is there a flush() and clear() function for that?

Hi @Mystik,

Yes, it is relatively easy to manage what is loaded in memory. Playcanvas by default will load all assets that have the asset.preload property to true during app load time or when they become first required during app play time (e.g. a model needs to be rendered, all materials and textures referenced by it are automatically loaded).

You can use the asset.loaded property to check if something is loaded or not.

What Playcanvas won’t do automatically is unload stuff from memory, but it provides the method to do so in code, asset.unload():


Ideally you should aim to have assets loaded in memory that are visible or about to get visible on screen, and afterwards you should unload them to free memory space. You can use the Profiler to monitor the total video memory used.

To reload an asset you unloaded manually you use the load method provided by the AssetRegistry:



You can read how Playcanvas handles assets loading here:



To further reduce the VRAM footprint of your app you should also use in addition to loading/unloading assets, texture compression:



Thank you for your great answers.

Another question about the reload:

To reload an asset you unloaded manually you use the load method provided by the AssetRegistry:

If I’m reloading an asset that was loaded through URL (loadFromUrl), do this will redownload the content or just reload in memory?

1 Like

Exactly, it will load it from the browser local cache, so no re-downloading is required.

Very interesting! Thank you again.