GPU memory leak when enabling shadow maps

Hello,

I made a scene with a directional light, a plane receiving light, and a set of meshes that cast light.
The meshes are created dynamically and created and destroyed very often.
The more meshes I create and set their castShadows = true, the more my VRAM is getting filled. Eventhough I dispose the geometry, texture and material after removing the recent mesh.
This is done in order to play volumetric videos.
There is no memory leak if I do not enable shadow maps.

Is there something I am missing and not disposeing?
I am using MeshBasicMaterial for the dynamic meshes.

Not that I am aware of. Are you able to demonstrate the memory leak with a minimal test case (based on e.g. jsfiddle).

I tried to… but this editor… it makes no sense.
Look, one object has shadow, the other doesn’t.

So I wasn’t even able to make the sample, it already has weird bugs.

Ok solved the basic issue. just did castShadows in plural instead of castShadow.
I was not able to reproduce the memory leak for now.

How to set castShadows? There is only castShadow property.

castShadows does not exists. When using the correct castShadow property the fiddle works as expected.

https://jsfiddle.net/ueswhqmj/1/

I set the renderer shadowMap.enable = true、light castShadow = true、object the castShaow and receiveShadow as true. when i dispose the geometry, texture and m eterial, the memory is not released.



image

@liumu96 I suggest you demonstrate the memory leak with a live example.

And please keep in mind it’s sufficient to post once and not in multiple topics (Curiosity about glTF GPU memory footprint - #9 by liumu96).