Possible Memory Leak When Loading and Deleting Splats
Hello,
I've been using the Supersplat Editor on Chrome and noticed that when a splat is removed, the memory is not fully freed.
To test this, I loaded and deleted the same .ply splat multiple times and observed the following memory usage:
- The first snapshot shows memory usage with no splat loaded.
- The second snapshot is after loading the splat.
- The third snapshot is after deleting the splat.
Even after deletion, memory usage remains higher than the initial state. Additionally, repeatedly loading and deleting the splat results in progressively higher memory consumption over time.
Is this behavior expected, or could this be a memory leak?
Let me know your thoughts, and thanks for all the work you put into this amazing project! 🚀
This is the expected behavior because when you perform a delete operation, it simply marks the splat's state as the DELETE state and does not delete the actual splats data
Then what should be the procedure to actually delete the splats data?
Hi @bolopenguin ,
When you say remove a splat, do you mean remove a splat from the scene in the SCENE panel, or do you mean selecting splats with a selection tool (brush/rect/etc) and then deleting them?
It's possible there is a memory leak when removing a splat scene from SuperSplat, but as @fenghuayumo says, "deleting" the currently selected splats will just flag them as deleted (we must keep the data in case you choose to undo the operation).
Remove the splat from the scene in the scene panel. Now I see why you are keeping the data. Thanks for your explanation.
So the destroy method of the splat element does not clear the memory too, right? If so, is there a way to force it?
We might be holding memory references that we shouldn't @bolopenguin, I'm not sure, will have to investigate.
TBH memory consumption is a really important part of supersplat. We've tried to be efficient with memory from the start, so if there is a leak it would be awesome to find.
asset.unload() is the big one, it calls resource.destroy() which contains all the data related to loaded splat.
Thank you, @slimbuck, for sharing your insights on this topic
No probs at all. Can I just ask, are you experiencing memory issues with SuperSplat? Is that why you're investigating?
No, not at all. I haven't performed enough operations in Supersplat to have a memory issue related to this. I just noticed this behavior and wanted to learn more about it.