#1477: Snapshots are taken when free RAM is below the memory governor's reserve #1478

Open
TheSlowly wants to merge 1 commit from TheSlowly/Slipstream:snapshot-mem-reserve into main
Collaborator

Fixes #1477.

Both snapshot paths used free RAM minus the governor's reserve (3.8 GB on 32 GB), so any time free RAM dipped under the reserve every snapshot was refused, even a 41 MB live one. A shared helper (LLSnapshotBufferLimits::hostHeadroomBytes) keeps the old headroom above the reserve, allows half of what's free below it, and caps at half the remaining commit on Windows.

Tests: snapshot_host_headroom_checks.cpp (standalone g++), snapshot_host_headroom_source_checks.py in indra/newview/tests.

Fixes #1477. Both snapshot paths used free RAM minus the governor's reserve (3.8 GB on 32 GB), so any time free RAM dipped under the reserve every snapshot was refused, even a 41 MB live one. A shared helper (LLSnapshotBufferLimits::hostHeadroomBytes) keeps the old headroom above the reserve, allows half of what's free below it, and caps at half the remaining commit on Windows. Tests: `snapshot_host_headroom_checks.cpp` (standalone g++), `snapshot_host_headroom_source_checks.py` in indra/newview/tests.
Both snapshot paths sized their system memory as free RAM minus the memory
governor's reserve (auto: 12% of RAM, 3.8 GB on a 32 GB machine). The reserve is
the governor's steady-state cushion for other programs, so whenever free RAM
dipped under it the headroom was zero and every snapshot was refused, even a
2560x1417 live one that needed 41 MB. LLSnapshotBufferLimits::hostHeadroomBytes
now gives a snapshot everything above the reserve as before, or half of what is
free when below it, and on Windows never more than half the commit still
available. vk_live_snapshot and snapshotFit both use it.

Test-Plan:
    g++ -std=c++17 -I../vkgfx snapshot_host_headroom_checks.cpp && ./a.out  (in indra/newview/tests;
    fails to build before, ok after)
    python3 indra/newview/tests/snapshot_host_headroom_source_checks.py (fails before, ok after)
    In world, with other programs holding RAM so the memgov log line shows avail below
    reserve: a 2560x1417 snapshot is taken (live path), no "not enough free system memory".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u snapshot-mem-reserve:TheSlowly-snapshot-mem-reserve
git switch TheSlowly-snapshot-mem-reserve
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sky_line/Slipstream!1478
No description provided.