Skip to content

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

Open
avt0m4t48 wants to merge 1 commit into
fxceless:mainfrom
avt0m4t48:fix/snapshot-pool-allocation-retry
Open

avt0m4t48 wants to merge 1 commit into
fxceless:mainfrom
avt0m4t48:fix/snapshot-pool-allocation-retry

Conversation

@avt0m4t48

Copy link
Copy Markdown

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.

desplmfao added a commit to desplmfao/VIctory that referenced this pull request Nov 25, 2026
… fails

A pool miss allocated with Vec::with_capacity, which aborts the process
when the allocation fails, even while the pool still holds idle buffers
(too small to fit, but up to POOL_BYTES plus the largest one). Try the
allocation with try_reserve_exact first; when it fails and the pool is
not empty, drop the idle buffers and make one last attempt with
reserve_exact, which aborts as before if that fails too. Pool hits and
successful misses are unchanged.

Idea from fxceless/victory-fork#360.

Co-Authored-By: avt0m4t48 <56218626+avt0m4t48@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant