Skip to content

viewer-tests: add depth start/stop memory leak regression test - #15277

Merged
remibettan merged 3 commits into
realsenseai:developmentfrom
remibettan:viewer-mem-leak-test
Jun 29, 2026
Merged

remibettan merged 3 commits into
realsenseai:developmentfrom
remibettan:viewer-mem-leak-test

Conversation

@remibettan

@remibettan remibettan commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

Tracked by: RSDEV-12247

Summary

Regression test for the GL texture leak fixed in #15275.

Drives the full viewer through 20 depth-only Start/Stop cycles (10s stream + 5s idle each, ≈5 min wall-clock), samples current process memory after each cycle, fits an OLS slope on iters 4–20 (first three are warmup), and fails if the slope exceeds 1 MB/iter.

Per-platform memory metric (all measure current — not peak — process memory, so the slope reflects per-cycle accumulation):

  • Windows: PROCESS_MEMORY_COUNTERS_EX.PrivateUsage (Task Manager's "Private Bytes")
  • Linux: /proc/self/status VmRSS
  • macOS: task_info(TASK_VM_INFO).phys_footprint

getrusage().ru_maxrss is deliberately not used — it's peak RSS, monotonically non-decreasing, useless for slope-based leak detection.

Measured slopes with the fix from #15275 (all well under the 1 MB/iter threshold):

  • Windows: ≈ 0.53 MB/iter (vs. ≈ 2.85 MB/iter without the fix → +48 MB drift, test fails)
  • Linux: ≈ 0.29 MB/iter

Also bumps the ImGui-test-engine watchdog (warning 60s, kill 1200s) so this soak test isn't killed at the default 60s.

Notes

  • Watchdog bump is global (imgui_test_engine v1.90.8 has no per-test API); a comment names this test and warns future contributors not to raise it further.

Test plan

Jenkins pipeline nightly gui run: https://rsjenkins.realsenseai.com/job/LRS_libci_pipeline/17005/

@sysrsbuild-gh-agentic sysrsbuild-gh-agentic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rs-agentic bot — automated review

Overall this is a well-structured regression test with a clear rationale. A few issues found below (see inline comments):

  • 🐛 Bug: get_private_bytes() returns 0 silently on Win32 API failure, poisoning baseline and slope
  • 🐛 Risk: get_splash() dereferences _splash_tex with no null guard after reset()
  • ⚠️ Enhancement: OLS denominator not explicitly guarded against zero (only n>=2 is checked)
  • ⚠️ Enhancement: Hard-coded CSV output path may be unwritable in some CI configurations
  • ⚠️ Enhancement: select_depth_only directly mutates internal map — fragile coupling
  • ⚠️ Enhancement: Global watchdog bump affects all tests; risk of long hangs on future regressions
  • ℹ️ Guideline: texture_buffer destructor should document that a live GL context is required at teardown

Comment thread common/ux-window.h Resolved
Comment thread common/rendering.h Resolved
@remibettan
remibettan requested a review from AviaAv June 24, 2026 11:14
@remibettan
remibettan force-pushed the viewer-mem-leak-test branch 2 times, most recently from 8b0970b to 675ab0b Compare June 28, 2026 20:01
@remibettan
remibettan force-pushed the viewer-mem-leak-test branch from 2bed94e to ad7fb6f Compare June 29, 2026 07:52

@AviaAv AviaAv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@remibettan
remibettan merged commit 8f1c0b6 into realsenseai:development Jun 29, 2026
29 checks passed
@remibettan
remibettan deleted the viewer-mem-leak-test branch July 7, 2026 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants