Is there a way to free CPU side memory once the mesh data is uploaded to GPU?
I tried to remove references to the geometry and texture Array Buffers so that they get garbage collected once they’ve been uploaded to GPU
something like this:
mesh.onAfterRender = () => {
if(mesh.geometry && mesh.geometry.attributes){
if (mesh.geometry.attributes.position) {
mesh.geometry.attributes.position.array = undefined;
if (mesh.geometry.attributes.position.data) {
mesh.geometry.attributes.position.data.array = undefined;
}
}
}
...
if (mesh.material && mesh.material.map) {
mesh.material.map.mipmaps = undefined;
if (mesh.material.map.source) {
mesh.material.map.source.data = undefined;
}
}
}
I do actually see the memory decrease slightly But the ArrayBuffers are still in memory so something else must hold a reference to them.