Files
betterxen/crates/ffi/tests
Swastick Chowdhury e3bbc955bc ffi: share one Metal device and queue across frame-loop sessions (#290)
Each frame-loop session opened its own Metal command queue. The GPU
driver allocates a per-queue working set on the first command buffer
(about 45 MiB on an Apple M5 with validation) and frees it
asynchronously 10-50 ms after the queue is released, so the footprint
read right after a session ended swung by about 50 MiB and the
repeated-sessions footprint test failed intermittently (5 of 30 runs).
There was no leak. Sessions now share one process-wide NativeCompute,
which is Send + Sync, so the working set is allocated once and kept.

Remove the settled_footprint wait added in #292: the original test
measures the immediate footprint again. Add a 50-session regression
test (completion, pause and resume, destroy while running) and a
concurrent two-session test for shared-queue correctness and session
isolation.

Signed-off-by: Swastick Chowdhury <28708247+Swastickc@users.noreply.github.com>
2026-11-24 19:07:18 +05:30
..