diff --git a/tests/python/gc_stress/many_large_many_rows_recordings.py b/tests/python/gc_stress/many_large_many_rows_recordings.py new file mode 100644 index 000000000000..ca535ae45626 --- /dev/null +++ b/tests/python/gc_stress/many_large_many_rows_recordings.py @@ -0,0 +1,26 @@ +""" +Stress test for cross-recording garbage collection. + +Logs many large recordings that contain a lot of large rows. + +Usage: +- Start a Rerun Viewer in release mode with 2GiB of memory limit: + `cargo r -p rerun-cli --release --no-default-features --features native_viewer -- --memory-limit 2GiB` +- Open the memory panel to see what's going on. +- Run this script. +- You should see recordings coming in and going out in a ringbuffer-like rolling fashion. +""" +from __future__ import annotations + +import rerun as rr +from numpy.random import default_rng + +rng = default_rng(12345) + +for i in range(0, 20000000): + rr.init("rerun_example_recording_gc", recording_id=f"image-rec-{i}", spawn=True) + for j in range(0, 10000): + positions = rng.uniform(-5, 5, size=[10000000, 3]) + colors = rng.uniform(0, 255, size=[10000000, 3]) + radii = rng.uniform(0, 1, size=[10000000]) + rr.log("points", rr.Points3D(positions, colors=colors, radii=radii)) diff --git a/tests/python/gc_stress/many_large_single_row_recordings.py b/tests/python/gc_stress/many_large_single_row_recordings.py new file mode 100644 index 000000000000..56405536574b --- /dev/null +++ b/tests/python/gc_stress/many_large_single_row_recordings.py @@ -0,0 +1,32 @@ +""" +Stress test for cross-recording garbage collection. + +Logs many large recordings that contain a single large row. + +Usage: +- Start a Rerun Viewer in release mode with 2GiB of memory limit: + `cargo r -p rerun-cli --release --no-default-features --features native_viewer -- --memory-limit 2GiB` +- Open the memory panel to see what's going on. +- Run this script. +- You should see recordings coming in and going out in a ringbuffer-like rolling fashion. +""" +from __future__ import annotations + +import time + +import rerun as rr +from numpy.random import default_rng + +rng = default_rng(12345) + +for i in range(0, 20000000): + rr.init("rerun_example_recording_gc", recording_id=f"recording-gc-rec-{i}", spawn=True) + + positions = rng.uniform(-5, 5, size=[10000000, 3]) + colors = rng.uniform(0, 255, size=[10000000, 3]) + radii = rng.uniform(0, 1, size=[10000000]) + rr.log("points", rr.Points3D(positions, colors=colors, radii=radii)) + + # Sleep because large rows will absolutely destroy the viewer. + # TODO(#4183): Investigate this. + time.sleep(1) diff --git a/tests/python/gc_stress/many_medium_sized_many_rows_recordings.py b/tests/python/gc_stress/many_medium_sized_many_rows_recordings.py new file mode 100644 index 000000000000..bae6acfefa1b --- /dev/null +++ b/tests/python/gc_stress/many_medium_sized_many_rows_recordings.py @@ -0,0 +1,27 @@ +""" +Stress test for cross-recording garbage collection. + +Logs many medium-sized recordings that contain a lot of small-ish rows. + +Usage: +- Start a Rerun Viewer in release mode with 500MiB of memory limit: + `cargo r -p rerun-cli --release --no-default-features --features native_viewer -- --memory-limit 500MiB` +- Open the memory panel to see what's going on. +- Run this script. +- You should see recordings coming in and going out in a ringbuffer-like rolling fashion. +""" +from __future__ import annotations + +import rerun as rr +from numpy.random import default_rng + +rng = default_rng(12345) + +for i in range(0, 20000000): + rr.init("rerun_example_recording_gc", recording_id=f"image-rec-{i}", spawn=True) + for j in range(0, 10000): + rr.set_time_sequence("frame", j) + positions = rng.uniform(-5, 5, size=[1000, 3]) + colors = rng.uniform(0, 255, size=[1000, 3]) + radii = rng.uniform(0, 1, size=[1000]) + rr.log("points", rr.Points3D(positions, colors=colors, radii=radii)) diff --git a/tests/python/gc_stress/many_medium_sized_single_row_recordings.py b/tests/python/gc_stress/many_medium_sized_single_row_recordings.py new file mode 100644 index 000000000000..8109dd857494 --- /dev/null +++ b/tests/python/gc_stress/many_medium_sized_single_row_recordings.py @@ -0,0 +1,32 @@ +""" +Stress test for cross-recording garbage collection. + +Logs many medium-sized recordings that contain a single medium-sized row. + +Usage: +- Start a Rerun Viewer in release mode with 200MiB of memory limit: + `cargo r -p rerun-cli --release --no-default-features --features native_viewer -- --memory-limit 200MiB` +- Open the memory panel to see what's going on. +- Run this script. +- You should see recordings coming in and going out in a ringbuffer-like rolling fashion. +""" +from __future__ import annotations + +import time + +import rerun as rr +from numpy.random import default_rng + +rng = default_rng(12345) + +for i in range(0, 20000000): + rr.init("rerun_example_recording_gc", recording_id=f"recording-gc-rec-{i}", spawn=True) + + positions = rng.uniform(-5, 5, size=[10000, 3]) + colors = rng.uniform(0, 255, size=[10000, 3]) + radii = rng.uniform(0, 1, size=[10000]) + rr.log("points", rr.Points3D(positions, colors=colors, radii=radii)) + + # Sleep so we don't run out of TCP sockets. + # Timings might need to be adjusted depending on your hardware. + time.sleep(0.05)