I try to generate an image art with three.js using PerspectiveCamera…
in my scene i create many objects, let say 10000 meshes. it takes ~15 seconds to render the finished scene.
The problem is when its finished, everything is static, no movement of camera scene or anything else.
if you check the memory usage, it still wasting resources after the renderer is finished (even if i stop the animate function), and its very laggy, taking some 10,000mb of my memory even after renderer is finished (checking it in Task Manager)
Is there anything i can do to take the final scene and make it like “static image” to really reduce the memory usage to ~zero, while still seeing the output in the browser?
Or in other words, take the final output of camera scene as image, dispose of all the memory the program used before (erase everything), and only stay with the output as if its a texture/image.
If you’re completely done rendering, I don’t think you have to mess with disposing of each geometry and material and texture. You can just dispose of the renderer itself. Delete any references to the scene and its contents, and they’ll be garbage collected after that.
@Joe1 Yeah, like Don said, if you are completely done with the scene and dispose the renderer (or even just let go of all the references without disposing) everything will eventually be GC’d (garbage collected).
If you happened to look at the memory usage before GC, you may see higher usage up until GC happens.
In your screenshot it looks like you are looking at Chrome usage overall, for all your tabs and processes (18 of them). So this isn’t representative of your specific app. Take a look at your specific app’s memory.
Lastly, make sure your app itself is not holding onto any references after you are done.