[SOLVED] Unload model doesn't release VRAM vertex buffers

I have noticed that when I unload a model ( when using a model component ) that the VRAM for vertex buffers is not released. If I repeatedly switch between the scenes then the vertex buffer VRAM goes up on each time the scene with the model component is switched to.

I now and again check for VRAM memory leaks when changing scenes, and I’m pretty sure this was working before for models with model components.

If I repeat the test with a render component and I unload the render asset and the model container then the VRAM for vertex buffers is released.

I can use the render component for new projects but my old projects use model components, so It would be good to find out what is going on.

Here is a test project. Run with Profiler on. There are 3 scenes. “Dev Empty Scene” which can be used as a Profiler reference when switching scenes. “Model Component Scene” and “Render Component Scene”. If you start up in “Dev Empty Scene” and then switch back an to between “Render Component Scene” then you’ll see that VRAM usage is all released when returning to the “Dev Empty Scene”. However when doing similar between “Dev Empty Scene” and “Model Component Scene” you can see that the VRAM for vertex buffers goes up and up.

https://playcanvas.com/project/813471/overview/vram-leak-test

1 Like

hey thank, I’ll investigate this,

4 Likes

I noticed this too on Friday. I was also patching VRAM leaks and noticed my model vertices/indices weren’t getting cleared. Thought it was just something wrong in my implementation.

FYI - still using model components that are programmatically added to the scene. Haven’t switched to render components yet.

2 Likes

and the fix is here:

it should be released with the next engine release in the near future. Thanks, that was a great repro project.

3 Likes

The fix was released today.

3 Likes

I tested and can also confirm that this is fixed in 1.45.1 :grinning:

3 Likes