GPU: a snapshot that fails to allocate frees the idle pool and tries once more #2151

Closed
desplmfao wants to merge 6 commits from upstream-pr/2153 into main
desplmfao commented 2026-11-25 06:20:51 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by desplmfao on 2026-11-25T06:20:51Z.


When a write snapshot needs a buffer and none in the idle pool fits, pooled calls Vec::with_capacity. If that allocation fails, the process aborts, even though the idle pool may hold hundreds of MB that nothing is using.

Change

crates/victory-gpu/src/shadow.rs, pooled (15 lines):

  • It tries try_reserve_exact first.
  • If that fails, it frees the idle pool, logs snapshot allocation failed; freeing the idle pool, and reserves once more with reserve_exact. That still aborts if memory is really gone.
  • give_back and POOL_BYTES are main's, unchanged.

History

This PR started as #472 (by @SaymonMaster14) brought up to date with main: an idle pool cap, a shared texture read buffer, and a dstorage buffer change. main has since done these its own way: a 512 MiB pool cap, and 8f2a6f14 for per-thread read buffers. As triage suggested, the PR is reduced to the one part main doesn't cover, the allocation retry. #472's commit is still in the branch history, but none of its changes are in the diff.

How it was found

Reading pooled while bringing #472 up to date with main. I haven't seen this abort in a title run; it matters on hosts where commit is tight, such as 16 GiB machines under Wine.

Tested

  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • shadow:: tests on an RTX 5080 under Proton: 10 passed.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:5486281204 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2153). Originally posted by [desplmfao](https://github.com/desplmfao) on 2026-11-25T06:20:51Z. --- When a write snapshot needs a buffer and none in the idle pool fits, `pooled` calls `Vec::with_capacity`. If that allocation fails, the process aborts, even though the idle pool may hold hundreds of MB that nothing is using. ## Change `crates/victory-gpu/src/shadow.rs`, `pooled` (15 lines): - It tries `try_reserve_exact` first. - If that fails, it frees the idle pool, logs `snapshot allocation failed; freeing the idle pool`, and reserves once more with `reserve_exact`. That still aborts if memory is really gone. - `give_back` and `POOL_BYTES` are `main`'s, unchanged. ## History This PR started as #472 (by @SaymonMaster14) brought up to date with `main`: an idle pool cap, a shared texture read buffer, and a `dstorage` buffer change. `main` has since done these its own way: a 512 MiB pool cap, and `8f2a6f14` for per-thread read buffers. As triage suggested, the PR is reduced to the one part `main` doesn't cover, the allocation retry. #472's commit is still in the branch history, but none of its changes are in the diff. ## How it was found Reading `pooled` while bringing #472 up to date with `main`. I haven't seen this abort in a title run; it matters on hosts where commit is tight, such as 16 GiB machines under Wine. ## Tested - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. - `shadow::` tests on an RTX 5080 under Proton: 10 passed. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
catminou4 commented 2026-11-25 06:33:10 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T06:33:10Z.

Review: COMMENTED


Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.

Idle snapshot pool memory capped (#472 rebased, 2 GB RAM) — memory-cap fix for long sessions; mixed gpu+hle, Windows-only.

<!-- greyfinch-sync:Marvisak/VIctory:review:6052890156 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2153#pullrequestreview-6052890156). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T06:33:10Z. **Review:** COMMENTED --- Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff. Idle snapshot pool memory capped (#472 rebased, 2 GB RAM) — memory-cap fix for long sessions; mixed gpu+hle, Windows-only.
yualk commented 2026-11-25 07:03:31 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by yualk on 2026-11-25T07:01:44Z.


Independent Windows x64 CPU-only probe on parent 940d32f69 vs this exact d23e5d9, using each pin's real pooled/give_back, touched pages, and GetProcessMemoryInfo(PROCESS_MEMORY_COUNTERS_EX). Only the idle shadow pool was exercised; no title, GPU dispatch, texture staging, or DirectStorage inputs.

  • Twelve 8 MiB leases, ABBA: both first and second live sets stayed 96 MiB; retained idle capacity 96 → 64 MiB. Process-private charge fell 32.08 MiB between arms at the idle sample. The refill touched all 12 again: observed page faults 9 → 8,222 and median measured lease/fill/check 3.52 → 5.11 ms.
  • Four 96 MiB leases, ABBA: both live sets stayed 384 MiB; idle 384 → 288 MiB and Windows private charge fell 96.19 MiB. Refill faults 9 → 24,635, measured 14.46 → 18.17 ms.
  • Small fit [8,32,96] kept and reused all leases on both. [384,128,128] kept all 640 MiB on both (largest + 256 MiB spare), so this is not a hard 256 MiB total-idle cap. The absolute values include allocator overhead. These are controlled refill costs, not an FPS or live game commit claim. AI-assisted.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7155409725 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2153#issuecomment-7155409725). Originally posted by [yualk](https://github.com/yualk) on 2026-11-25T07:01:44Z. --- Independent Windows x64 CPU-only probe on parent `940d32f69` vs this exact `d23e5d9`, using each pin's real `pooled`/`give_back`, touched pages, and `GetProcessMemoryInfo(PROCESS_MEMORY_COUNTERS_EX)`. Only the idle shadow pool was exercised; no title, GPU dispatch, texture staging, or DirectStorage inputs. - Twelve 8 MiB leases, ABBA: both first and second live sets stayed 96 MiB; retained idle capacity 96 → 64 MiB. Process-private charge fell 32.08 MiB between arms at the idle sample. The refill touched all 12 again: observed page faults 9 → 8,222 and median measured lease/fill/check 3.52 → 5.11 ms. - Four 96 MiB leases, ABBA: both live sets stayed 384 MiB; idle 384 → 288 MiB and Windows private charge fell 96.19 MiB. Refill faults 9 → 24,635, measured 14.46 → 18.17 ms. - Small fit `[8,32,96]` kept and reused all leases on both. `[384,128,128]` kept all 640 MiB on both (largest + 256 MiB spare), so this is not a hard 256 MiB total-idle cap. The absolute values include allocator overhead. These are controlled refill costs, not an FPS or live game commit claim. AI-assisted.
desplmfao commented 2026-11-25 09:06:07 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by desplmfao on 2026-11-25T08:08:46Z.


Added d389937: when a new snapshot buffer can't be allocated, the idle pool is freed and the allocation tried once more (try_reserve_exact first, so a failed attempt returns instead of aborting). The idea comes from fxceless/victory-fork#360 (avt0m4t48, credited in the commit). It only changes the out-of-memory path. cargo test -p victory-gpu shadow: 4 passed. Clippy is clean.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7156661388 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2153#issuecomment-7156661388). Originally posted by [desplmfao](https://github.com/desplmfao) on 2026-11-25T08:08:46Z. --- Added `d389937`: when a new snapshot buffer can't be allocated, the idle pool is freed and the allocation tried once more (`try_reserve_exact` first, so a failed attempt returns instead of aborting). The idea comes from fxceless/victory-fork#360 (avt0m4t48, credited in the commit). It only changes the out-of-memory path. `cargo test -p victory-gpu shadow`: 4 passed. Clippy is clean.
desplmfao commented 2026-11-25 09:06:18 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by desplmfao on 2026-11-25T08:33:44Z.


@yualk thanks for the independent probe. That matches the intent: the largest idle buffer is always kept, and others only up to 256 MiB more, so [384,128,128] keeping 640 MiB is by design, not a total cap. Keeping the largest is what saves most of the page faults on the hot path (the world's big heap snapshot). The extra faults you measured are the cost of refilling the smaller ones. In the game that cost didn't show up in frame time: 428–452 ms per world frame with this PR against 442–451 ms without it (RTX 5080, Linux/Proton), while the idle pool went from 2,040 MB to 111–214 MB.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7157186833 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2153#issuecomment-7157186833). Originally posted by [desplmfao](https://github.com/desplmfao) on 2026-11-25T08:33:44Z. --- @yualk thanks for the independent probe. That matches the intent: the largest idle buffer is always kept, and others only up to 256 MiB more, so `[384,128,128]` keeping 640 MiB is by design, not a total cap. Keeping the largest is what saves most of the page faults on the hot path (the world's big heap snapshot). The extra faults you measured are the cost of refilling the smaller ones. In the game that cost didn't show up in frame time: 428–452 ms per world frame with this PR against 442–451 ms without it (RTX 5080, Linux/Proton), while the idle pool went from 2,040 MB to 111–214 MB.
Marvisak commented 2026-11-25 12:03:45 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T11:24:28Z.


Automated triage for the maintainers.

Verdict: merge candidate. Thanks for splitting it as suggested. The diff is now only crates/victory-gpu/src/shadow.rs pooled: when no idle buffer fits, it calls try_reserve_exact; on failure it logs, clears the idle pool, and calls reserve_exact once more, which still aborts if memory is really gone. give_back and POOL_BYTES are main's, so main's 512 MiB cap is unchanged.

Checked: when the first attempt succeeds the second reserve_exact is a no-op (capacity already ≥ n), and with an empty pool the behaviour is the same as main's Vec::with_capacity. So this only changes the out-of-memory path, as described.

CI: passing (check; one earlier run on the same head failed and the later run passed).


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7161005549 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2153#issuecomment-7161005549). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T11:24:28Z. --- <!-- victory-triage v1 head=c21a05423c759adec83db35dbd07fcc07ee08afa verdict=merge-candidate at=2026-11-26T03:25:25Z --> Automated triage for the maintainers. **Verdict: merge candidate.** Thanks for splitting it as suggested. The diff is now only `crates/victory-gpu/src/shadow.rs` `pooled`: when no idle buffer fits, it calls `try_reserve_exact`; on failure it logs, clears the idle pool, and calls `reserve_exact` once more, which still aborts if memory is really gone. `give_back` and `POOL_BYTES` are `main`'s, so `main`'s 512 MiB cap is unchanged. Checked: when the first attempt succeeds the second `reserve_exact` is a no-op (capacity already ≥ `n`), and with an empty pool the behaviour is the same as `main`'s `Vec::with_capacity`. So this only changes the out-of-memory path, as described. CI: passing (`check`; one earlier run on the same head failed and the later run passed). --- _Generated by [Claude Code](https://claude.ai/code)_
desplmfao commented 2026-11-25 12:03:48 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by desplmfao on 2026-11-25T11:30:08Z.


Thanks for the triage. Done in 0f13780: staging_bytes in dstorage.rs is back to main's version, and this PR no longer touches victory-hle. It came along with the #472 rebase. As you say, the pool cap doesn't need it, and I have no evidence that the console counts the intermediate buffer, so it's out rather than moved. What's left is the pool cap (give_back, POOL_BYTES), the idle-pool retry before reserve_exact aborts, and the shared texture SCRATCH. Clippy is clean.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7161129328 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2153#issuecomment-7161129328). Originally posted by [desplmfao](https://github.com/desplmfao) on 2026-11-25T11:30:08Z. --- Thanks for the triage. Done in `0f13780`: `staging_bytes` in `dstorage.rs` is back to `main`'s version, and this PR no longer touches `victory-hle`. It came along with the #472 rebase. As you say, the pool cap doesn't need it, and I have no evidence that the console counts the intermediate buffer, so it's out rather than moved. What's left is the pool cap (`give_back`, `POOL_BYTES`), the idle-pool retry before `reserve_exact` aborts, and the shared texture `SCRATCH`. Clippy is clean.
desplmfao commented 2026-11-25 16:09:17 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by desplmfao on 2026-11-25T15:42:07Z.


Merged main in cb471dc (merge commit, no rebase). main has since covered part of this PR in its own way, so the PR is smaller now:

  • Dropped here: the shared texture read buffer. main's 8f2a6f14 (a texture refresh reads into its thread's own buffer) does the same job, and I took main's texture.rs as is.
  • What stays (only shadow.rs, about 40 lines against main): a snapshot grows in place instead of being made anew and copied; when an allocation fails, the idle pool is freed and it tries once more instead of aborting; and the pool keeps its largest buffer plus at most 256 MB / 8 others, where main now keeps up to 512 MB in all.

The 2 GB in the title was measured against main before its own 512 MB cap. Against today's main, the saving is the difference between the two caps, which I haven't measured yet. shadow:: tests: 8 passed under Wine; clippy clean.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7167248311 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2153#issuecomment-7167248311). Originally posted by [desplmfao](https://github.com/desplmfao) on 2026-11-25T15:42:07Z. --- Merged `main` in `cb471dc` (merge commit, no rebase). `main` has since covered part of this PR in its own way, so the PR is smaller now: - **Dropped here:** the shared texture read buffer. `main`'s `8f2a6f14` (a texture refresh reads into its thread's own buffer) does the same job, and I took `main`'s `texture.rs` as is. - **What stays (only `shadow.rs`, about 40 lines against `main`):** a snapshot grows in place instead of being made anew and copied; when an allocation fails, the idle pool is freed and it tries once more instead of aborting; and the pool keeps its largest buffer plus at most 256 MB / 8 others, where `main` now keeps up to 512 MB in all. The 2 GB in the title was measured against `main` before its own 512 MB cap. Against today's `main`, the saving is the difference between the two caps, which I haven't measured yet. `shadow::` tests: 8 passed under Wine; clippy clean.
desplmfao commented 2026-11-25 16:09:23 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by desplmfao on 2026-11-25T15:50:25Z.


The check failure on cb471dc isn't from this PR. The failing test is emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index in victory-shader, and this PR only changes victory-gpu/src/shadow.rs. main's own CI fails the same way at da82e444, the commit I merged. main has since added 67e8ae14 ("Shader tests: the compute harness zeroes its UAVs"), whose CI is still running. Once that's green, I'll merge main again so this PR's CI follows.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7167358509 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2153#issuecomment-7167358509). Originally posted by [desplmfao](https://github.com/desplmfao) on 2026-11-25T15:50:25Z. --- The `check` failure on `cb471dc` isn't from this PR. The failing test is `emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index` in `victory-shader`, and this PR only changes `victory-gpu/src/shadow.rs`. `main`'s own CI fails the same way at `da82e444`, the commit I merged. `main` has since added `67e8ae14` ("Shader tests: the compute harness zeroes its UAVs"), whose CI is still running. Once that's green, I'll merge `main` again so this PR's CI follows.
upstream-sync changed title from [PR #2153] GPU: cap idle snapshot pool memory (#472 rebased; 2 GB RAM in the world) to [PR #2153] GPU: a snapshot that fails to allocate frees the idle pool and tries once more 2026-11-26 03:03:52 +00:00
desplmfao commented 2026-11-26 03:05:12 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by desplmfao on 2026-11-26T02:33:47Z.


Split as suggested, in c21a054. give_back and POOL_BYTES are main's again, so main's 512 MiB cap applies unchanged. As you pointed out, our rule could hold more than that. The PR is now only the allocation retry in pooled: try to reserve, and if that fails, free the idle pool and reserve once more. The diff is 15 lines in shadow.rs, shadow:: gives 10 passed under Wine, and clippy is clean. The title is updated to match.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7180917316 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2153#issuecomment-7180917316). Originally posted by [desplmfao](https://github.com/desplmfao) on 2026-11-26T02:33:47Z. --- Split as suggested, in `c21a054`. `give_back` and `POOL_BYTES` are `main`'s again, so `main`'s 512 MiB cap applies unchanged. As you pointed out, our rule could hold more than that. The PR is now only the allocation retry in `pooled`: try to reserve, and if that fails, free the idle pool and reserve once more. The diff is 15 lines in `shadow.rs`, `shadow::` gives 10 passed under Wine, and clippy is clean. The title is updated to match.
fuzeofficlal commented 2026-11-26 15:13:29 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T15:13:29Z.

Review: APPROVED


Reviewed crates/victory-gpu/src/shadow.rs at c21a0542 (already based on origin/main 63bcca43) and verified on RTX 5090 and WARP (VICTORY_D3D12_WARP=1) with VICTORY_D3D12_DEBUG=1.

Allocation retry & state-safety audit

  • In pooled(n) (crates/victory-gpu/src/shadow.rs:102-128), when no idle buffer fits, v.try_reserve_exact(n) (shadow.rs:117) runs first:
    • When it succeeds, smaller idle buffers stay in POOL and the trailing v.reserve_exact(n) (shadow.rs:124) is a no-op (no second allocation).
    • When it fails and !pool.is_empty(), it logs a warning, releases the idle pool (pool.clear() at shadow.rs:122, freeing up to POOL_BYTES = 512 MiB), and attempts v.reserve_exact(n) once more — no retry loop, and if commit is still exhausted it aborts cleanly before Shadow::writing mutates self.before segments.
    • Holding POOL across the clear-and-retry prevents another thread from refilling the pool or racing the retry; POOL is a leaf lock never nested with other locks.

Verification

  • cargo run -p xtask -- policy: 191 files ok.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings (default and --all-features): clean.
  • shadow:: with VICTORY_D3D12_DEBUG=1: 10/10 passed on RTX 5090 and 10/10 passed on WARP (--features diagnostics).
  • Additional synthetic probe exercising pooled(0), pool miss (verifying smaller pooled buffers remain intact when try_reserve_exact succeeds), and pool hit reuse (len() == 0, capacity preserved) passed cleanly.
<!-- greyfinch-sync:Marvisak/VIctory:review:6076555851 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2153#pullrequestreview-6076555851). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T15:13:29Z. **Review:** APPROVED --- Reviewed `crates/victory-gpu/src/shadow.rs` at `c21a0542` (already based on `origin/main` `63bcca43`) and verified on RTX 5090 and WARP (`VICTORY_D3D12_WARP=1`) with `VICTORY_D3D12_DEBUG=1`. ### Allocation retry & state-safety audit - In `pooled(n)` (`crates/victory-gpu/src/shadow.rs:102-128`), when no idle buffer fits, `v.try_reserve_exact(n)` (`shadow.rs:117`) runs first: - When it succeeds, smaller idle buffers stay in `POOL` and the trailing `v.reserve_exact(n)` (`shadow.rs:124`) is a no-op (no second allocation). - When it fails and `!pool.is_empty()`, it logs a warning, releases the idle pool (`pool.clear()` at `shadow.rs:122`, freeing up to `POOL_BYTES` = 512 MiB), and attempts `v.reserve_exact(n)` **once more** — no retry loop, and if commit is still exhausted it aborts cleanly before `Shadow::writing` mutates `self.before` segments. - Holding `POOL` across the clear-and-retry prevents another thread from refilling the pool or racing the retry; `POOL` is a leaf lock never nested with other locks. ### Verification - `cargo run -p xtask -- policy`: 191 files ok. - `cargo clippy -p victory-gpu --all-targets -- -D warnings` (default and `--all-features`): clean. - `shadow::` with `VICTORY_D3D12_DEBUG=1`: **10/10 passed** on RTX 5090 and **10/10 passed** on WARP (`--features diagnostics`). - Additional synthetic probe exercising `pooled(0)`, pool miss (verifying smaller pooled buffers remain intact when `try_reserve_exact` succeeds), and pool hit reuse (`len() == 0`, capacity preserved) passed cleanly.
Dukestar69 commented 2026-11-26 22:31:02 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T22:31:02Z.

Review: APPROVED


LGTM — verified on RTX 5090 (Windows / D3D12) against origin/main (63bcca4).

  • Releasing the idle snapshot pool and retrying once when a snapshot allocation fails cleanly recovers from transient memory pressure.
  • cargo test -p victory-gpu --lib shadow:: -- --test-threads=1: all passed.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6081140430 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2153#pullrequestreview-6081140430). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T22:31:02Z. **Review:** APPROVED --- LGTM — verified on RTX 5090 (Windows / D3D12) against `origin/main` (`63bcca4`). - Releasing the idle snapshot pool and retrying once when a snapshot allocation fails cleanly recovers from transient memory pressure. - `cargo test -p victory-gpu --lib shadow:: -- --test-threads=1`: all passed. - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
andrewpozdnakov7-jpg commented 2026-11-26 23:06:51 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T23:06:51Z.


I resolved the shadow.rs conflict between #3384 2b0d14c and #2153 c21a054 in 0dd0f3d. The merge keeps sorted best-fit reuse and the 512 MiB retention policy, and releases idle buffers before retrying a failed fresh reservation.

The original #3384 test shared the process-wide pool. One controlled peer take between the two length checks made it see 1,998 entries when it expected 1,999. The replacement uses its own pool and keeps the best-fit, sorted order, return and successful miss checks. All 11 shadow tests, strict Clippy in both configurations and asset policy passed.

Using a test-only allocator in a separate process, I rejected the first synthetic reservation. The combined code made two attempts, freed both idle buffers and returned the requested empty buffer. With a successful first reservation, there was one attempt and both idle buffers stayed.

@desplmfao, the combined branch is available to check against the allocation retry before the two PRs land. If you reapply the resolution or its pool regression, please retain the Git author or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7205265608 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2153#issuecomment-7205265608). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-26T23:06:51Z. --- I resolved the `shadow.rs` conflict between #3384 `2b0d14c` and #2153 `c21a054` in [`0dd0f3d`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/0dd0f3d6a2b5dbd6f78063c196060439ceb9d5fc). The merge keeps sorted best-fit reuse and the 512 MiB retention policy, and releases idle buffers before retrying a failed fresh reservation. The original #3384 test shared the process-wide pool. One controlled peer take between the two length checks made it see 1,998 entries when it expected 1,999. The replacement uses its own pool and keeps the best-fit, sorted order, return and successful miss checks. All 11 shadow tests, strict Clippy in both configurations and asset policy passed. Using a test-only allocator in a separate process, I rejected the first synthetic reservation. The combined code made two attempts, freed both idle buffers and returned the requested empty buffer. With a successful first reservation, there was one attempt and both idle buffers stayed. @desplmfao, the combined branch is available to check against the allocation retry before the two PRs land. If you reapply the resolution or its pool regression, please retain the Git author or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`.
desplmfao commented 2026-11-27 08:20:46 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by desplmfao on 2026-11-27T08:20:46Z.


#3384 (borosf) changes the same pooled/give_back. @andrewpozdnakov7-jpg has resolved the two together in 0dd0f3d, including this PR's retry. I've asked on #3384 for that to go in there, and I'll close this one once #3384 carries the retry.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7213434604 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2153#issuecomment-7213434604). Originally posted by [desplmfao](https://github.com/desplmfao) on 2026-11-27T08:20:46Z. --- #3384 (borosf) changes the same `pooled`/`give_back`. @andrewpozdnakov7-jpg has resolved the two together in `0dd0f3d`, including this PR's retry. I've asked on #3384 for that to go in there, and I'll close this one once #3384 carries the retry.
desplmfao commented 2026-11-27 09:06:58 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by desplmfao on 2026-11-27T09:06:58Z.


Closing in favour of #3384. Its abc64683 carries this PR's retry together with the sorted snapshot pool, so only one PR changes pooled/give_back.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7214296856 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2153#issuecomment-7214296856). Originally posted by [desplmfao](https://github.com/desplmfao) on 2026-11-27T09:06:58Z. --- Closing in favour of #3384. Its `abc64683` carries this PR's retry together with the sorted snapshot pool, so only one PR changes `pooled`/`give_back`.

Pull request closed

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
Marvisak/VIctory!2151
No description provided.