Is seems there is no documented way to unload a ResourceContainer (Memory issue over time)

Hi everyone,

I used the tutorial to load GLBs from the cloud (Loading Draco Compressed GLBs | Learn PlayCanvas) with the tutorial provided by your Team. It works great for loading.

However, since I need to swap (load/unload) containers, i am having memory leaks happening with Draco overtime (when swapping hundreds of time). I have one GLB for the Model, and One GLB per animations.

Here is a snapshot of my chrome memory:

My question is : Do i simply need to keep a reference by id of the container and call the unload method from the AppRegistry ? Or do I need to unload all the renders, animations, individually? Because over a long period of time it seems my memory size is increasing. My sample scene was only loading and deloading some models from the cloud.

I would really appreciate if someone could provide me an example of how to unload a resourcecontainer from the appRegistry ? There is no methods in ResourceContainer or examples in your documentation. Would be great to add this in the GLB example as well.

Thank you very much.

Tristan

Hi @T_Froggo,

I haven’t tried that myself, but can you try unloading both the container asset and any other assets referenced in the containerAsset.resource resource property?

You just loop through all of them and call asset.unload().

Hey Leonidas,

Yeah, this was my initial guess, I might end up doing that. Thanks for the response.

1 Like