supersplat icon indicating copy to clipboard operation
supersplat copied to clipboard

Possible Memory Leak When Loading and Deleting Splats

Open bolopenguin opened this issue 10 months ago • 9 comments

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:

Image

  • 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! 🚀

bolopenguin avatar Feb 18 '25 15:02 bolopenguin

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

fenghuayumo avatar Feb 19 '25 11:02 fenghuayumo

Then what should be the procedure to actually delete the splats data?

bolopenguin avatar Feb 19 '25 13:02 bolopenguin

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?

slimbuck avatar Feb 19 '25 13:02 slimbuck

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).

slimbuck avatar Feb 19 '25 13:02 slimbuck

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?

bolopenguin avatar Feb 19 '25 13:02 bolopenguin

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.

slimbuck avatar Feb 19 '25 15:02 slimbuck

Thank you, @slimbuck, for sharing your insights on this topic

bolopenguin avatar Feb 19 '25 16:02 bolopenguin

No probs at all. Can I just ask, are you experiencing memory issues with SuperSplat? Is that why you're investigating?

slimbuck avatar Feb 19 '25 16:02 slimbuck

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.

bolopenguin avatar Feb 19 '25 16:02 bolopenguin