PrismarineJS/prismarine-viewer

Storage leaks #196

antithug posted onGitHub

I'm using prismarine-web-client, and threejs objects are not getting released. I believe you have to 'dispose' of all the threejs objects (textures, materials, etc.) to get them to release the webgl data. With a big world, you can only play for a short time before the browser tab quits.

When a chunk is unloaded in the web client, it seems to be handled properly - the prismarine chunk is deleted. And that should release the underlying threejs objects, but you need to explicitly dispose of the textures, materials, etc. If you look at the heap snapshots, the storage that leaks is the system/JSArrayBufferData, which I think is the webgl system data. Everything else looks fine.


Additional infos:

  • Terrain texture and material are shared for all chunks, so their lifetime is the duration of the application, there is no need to release them
  • Entity materials are created for each entity, we can dispose of them as a temporary fix, but the real fix would be to have a cache
  • Entity textures (actually all textures) are managed by a cache so they are loaded once and reuse so that shouldnt be an issue either
  • We should check if the geometry buffers are released (there are no explicit code other than simply removing the mesh from the scene) that could be the leak you are viewing
posted by Karang almost 4 years ago

Maybe the meshes is enough. Can you point me to the code to make the fix? I can test it quickly.

posted by antithug almost 4 years ago

Fund this Issue

$0.00
Funded

Pull requests