rerun-io / rerun

Visualize streams of multimodal data. Fast, easy to use, and simple to integrate. Built in Rust using egui.
https://rerun.io/
Apache License 2.0
5.73k stars 258 forks source link

GPU memory not freed when closing recording, but keeping viewer open #6755

Open roym899 opened 6 days ago

roym899 commented 6 days ago

Describe the bug It seems like GPU memory is not freed when closing the recording for meshes (only noticed / tested for meshes with large number of vertices, not sure how generally this applies).

As a workaround I have to close the viewer occasionally.

To Reproduce Run the following code a few times while monitoring GPU memory usage. Memory keeps growing and closing the recordings does not free it.

import numpy as np
import rerun as rr

rr.init("Large Mesh", spawn=True)
vertices = np.random.rand(3 * 3000000, 3)
rr.log("mesh", rr.Mesh3D(vertex_positions=vertices))

Expected behavior Memory should be freed when closing a recording in the viewer.

Screenshots

https://github.com/rerun-io/rerun/assets/9785832/0ccee3a2-df56-4cf5-bee4-7f01909adee3

memory Note that "Counted GPU" only goes up, never down.

Backtrace

Desktop (please complete the following information):

Rerun version

rerun-cli 0.17.0-alpha.8 [rustc 1.76.0 (07dca489a 2024-02-04), LLVM 17.0.6] x86_64-unknown-linux-gnu 6649/merge a6a666f, built 2024-06-25T19:47:07Z

Also tested with 0.16.1.

Wumpf commented 6 days ago

Likely at least partially related to

we're also not good at freeing up anything in that staging belt.

However, one would expect to at least the meshes to disappear from the MeshCache, that's apparently not happening!