GPU: release CPU reservations when by-address setup fails #1525

Open
Swagi-REDACTED wants to merge 1 commit from upstream-pr/1525 into main
Swagi-REDACTED commented 2026-11-29 06:24:28 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Swagi-REDACTED on 2026-11-29T06:24:28Z.


A failed GPU backing allocation or copy registration in Memory::another abandoned a 64 MiB CPU allocation made with MEM_RESERVE | MEM_COMMIT. Retrying could leak another 64 MiB each time. Directory setup had the same ownership gap if its backing copy or faults buffer failed.

What changed

The CPU reservation now owns its Windows allocation until setup succeeds. An early return releases it with VirtualFree(..., MEM_RELEASE). Successfully published areas retain their existing lifetime.

Evidence

A local integration run of A newer retail game logged 224 failed 64 MiB shared-buffer requests in 3.4 seconds. Between adjacent five-second samples, process private commit rose from 23,722 to 38,349 MiB. Multiple paths call the shared-buffer allocator, so the log alone cannot attribute every failure or the entire increase to this leak.

The regression uses a small Windows allocation and checks its state with VirtualQuery after abandoning it. Before adding cleanup it remained MEM_COMMIT. With cleanup it is MEM_FREE.

Tested

Windows 11, Ryzen 7 9800X3D, 16 GiB RAM, GeForce RTX 3060 12 GiB, Rust 1.98.1.

cargo +1.98.1 test --release --locked --offline -j 2 -p victory-gpu --lib -- --test-threads=1 --nocapture (local target directory omitted).

Revision Passed Failed Ignored
Base 368967f 414 2 35
Head f7d3d0f 415 2 35

Both failed indirect::tests::host_list_budget_starts_empty_at_each_submission and indirect::tests::warp_batch_charges_every_execution.

Not tested

Full workspace, end-to-end memory savings, and frame-rate impact.

AI use

Codex, GPT-6 (exact serving variant unavailable), traced the failure path, wrote the fix and regression, and ran the comparisons.

<!-- greyfinch-sync:fxceless/victory-fork:issue:5548244316 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1525). Originally posted by [Swagi-REDACTED](https://github.com/Swagi-REDACTED) on 2026-11-29T06:24:28Z. --- A failed GPU backing allocation or copy registration in `Memory::another` abandoned a 64 MiB CPU allocation made with `MEM_RESERVE | MEM_COMMIT`. Retrying could leak another 64 MiB each time. Directory setup had the same ownership gap if its backing copy or faults buffer failed. **What changed** The CPU reservation now owns its Windows allocation until setup succeeds. An early return releases it with `VirtualFree(..., MEM_RELEASE)`. Successfully published areas retain their existing lifetime. **Evidence** A local integration run of **A newer retail game** logged 224 failed 64 MiB shared-buffer requests in 3.4 seconds. Between adjacent five-second samples, process private commit rose from 23,722 to 38,349 MiB. Multiple paths call the shared-buffer allocator, so the log alone cannot attribute every failure or the entire increase to this leak. The regression uses a small Windows allocation and checks its state with `VirtualQuery` after abandoning it. Before adding cleanup it remained `MEM_COMMIT`. With cleanup it is `MEM_FREE`. **Tested** Windows 11, Ryzen 7 9800X3D, 16 GiB RAM, GeForce RTX 3060 12 GiB, Rust 1.98.1. `cargo +1.98.1 test --release --locked --offline -j 2 -p victory-gpu --lib -- --test-threads=1 --nocapture` (local target directory omitted). | Revision | Passed | Failed | Ignored | |---|---:|---:|---:| | Base `368967f` | 414 | 2 | 35 | | Head `f7d3d0f` | 415 | 2 | 35 | Both failed `indirect::tests::host_list_budget_starts_empty_at_each_submission` and `indirect::tests::warp_batch_charges_every_execution`. **Not tested** Full workspace, end-to-end memory savings, and frame-rate impact. **AI use** Codex, GPT-6 (exact serving variant unavailable), traced the failure path, wrote the fix and regression, and ran the comparisons.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1525:upstream-pr/1525'
git switch 'upstream-pr/1525'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1525'
git switch 'upstream-pr/1525'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1525'
git switch 'upstream-pr/1525'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1525'
git switch 'main'
git merge --squash 'upstream-pr/1525'
git switch 'main'
git merge --ff-only 'upstream-pr/1525'
git switch 'main'
git merge 'upstream-pr/1525'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
fxceless/victory-fork!1525
No description provided.