GPU: retry CPU snapshot allocations after releasing idle buffers #360

Open
avt0m4t48 wants to merge 1 commit from upstream-pr/360 into main
avt0m4t48 commented 2026-11-24 23:53:16 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by avt0m4t48 on 2026-11-24T23:53:16Z.


Refs #321.

A CPU snapshot pool miss currently calls Vec::with_capacity even when the pool still holds idle buffers of other sizes. If that allocation fails, the process exits without releasing those buffers. Try the exact allocation first. When it fails, clear the idle pool and make one final attempt. Pool hits still reuse the same buffers, and an empty pool takes the direct path.

The idle pool owns buffers only after their snapshots have finished. This change is separate from #47's retention cap and #200's admission rules.

I exercised the exact pool code with a test allocator that rejected an 8,396,800-byte request while a reusable 1 MiB allocation was held. Main exited on the rejected request. This branch released the idle buffer and succeeded on its second attempt. The normal pool miss and exact-fit reuse controls passed on both revisions. Windows MSVC GPU test targets type-checked with diagnostics and warnings denied.

The size in #321 is also possible in texture scratch allocation. These checks establish recovery for the snapshot-pool path. The reported game crash and Windows commit-pressure behavior still need runtime confirmation.

AI-assisted using Codex.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6593849121 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/360). Originally posted by [avt0m4t48](https://github.com/avt0m4t48) on 2026-11-24T23:53:16Z. --- Refs #321. A CPU snapshot pool miss currently calls `Vec::with_capacity` even when the pool still holds idle buffers of other sizes. If that allocation fails, the process exits without releasing those buffers. Try the exact allocation first. When it fails, clear the idle pool and make one final attempt. Pool hits still reuse the same buffers, and an empty pool takes the direct path. The idle pool owns buffers only after their snapshots have finished. This change is separate from #47's retention cap and #200's admission rules. I exercised the exact pool code with a test allocator that rejected an 8,396,800-byte request while a reusable 1 MiB allocation was held. Main exited on the rejected request. This branch released the idle buffer and succeeded on its second attempt. The normal pool miss and exact-fit reuse controls passed on both revisions. Windows MSVC GPU test targets type-checked with diagnostics and warnings denied. The size in #321 is also possible in texture scratch allocation. These checks establish recovery for the snapshot-pool path. The reported game crash and Windows commit-pressure behavior still need runtime confirmation. AI-assisted using Codex.
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/360:upstream-pr/360'
git switch 'upstream-pr/360'

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/360'
git switch 'upstream-pr/360'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/360'
git switch 'upstream-pr/360'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/360'
git switch 'main'
git merge --squash 'upstream-pr/360'
git switch 'main'
git merge --ff-only 'upstream-pr/360'
git switch 'main'
git merge 'upstream-pr/360'
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!360
No description provided.