Reduce PFE native allocator retention after playfield churn
Follow-up to post-fix production analysis tsk_5j446c4ges and navigation ownership fix tsk_ja2grbuq8p / PR #2555. Confirmed production state At ~6 hours uptime, primary PFE RSS was ~16.6 GiB. Dump partitions into ~5.72 GiB committed managed heap and 10.53 GiB across 217 glibc secondary heap mappings / 134 arenas. The chunk walk finds only 1.39 GiB in-use-marked and 9.14 GiB free inside glibc arenas (3.95 GiB top chunks, 5.19 GiB interior). 155 heaps with <=1 MiB used retain 6.97 GiB free; the 134 arena-head heaps alone retain 5.25 GiB free. This is the continuing monotonic native footprint. The previous Detour leak is fixed: 45 live navigation sessions, no detached validated node pools or tile arrays; current native navigation tiles are ~209 MiB. Current Bepu pools own 1.11 GiB across 46 playfields and represent most live native allocations. Freed historical ownership is unavailable after coalescing, so the dump does not prove Bepu created every free hole. Current Bepu blocks coexist with 2.23 GiB free across their heaps; glibc/runtime and other native allocation churn also contribute. Amplifier evidence Program sets ThreadPool.SetMinThreads(1000,1000). Dump has 112 managed Thread objects and 89 worker-local queues; trace has 111 thread profiles. High thread fan-out permits many glibc arenas. This is evidence of an allocator-retention mechanism, not proof that SetMinThreads alone creates all threads or that a specific arena cap is contention-free. Intended outcome Keep RSS close to live native demand as playfields/physics worlds are created and disposed, without introducing allocator contention or tick latency regressions. Approach / acceptance - Reproduce representative playfield create/load/dispose churn locally with production collision meshes where available; record RSS/PSS, glibc arena/free/live bytes, Bepu pool accounting and tick latency over repeated cycles. - Audit the reason for 1000 worker and I/O minimums and current blocking/sync-over-async paths. Reduce/remove the override only with starvation/latency evidence; worker and completion-port values need not be identical. - Evaluate a bounded glibc arena setting (for example 4/8 via MALLOC_ARENA_MAX or GLIBC_TUNABLES) under load. Treat this as the leading mitigation, not an assumed safe production toggle. Compare contention and p95/p99 tick/action latency. - Consider explicit trim only as a measured operational fallback at safe lifecycle boundaries; do not add periodic trim calls that can cause global allocator pauses. - Profile native allocation call stacks if the harness leaves significant unexplained live/retained memory. Assess whether immutable collision buffers can be shared safely across same-base-playfield instances without sharing mutable simulations. - Validation demonstrates bounded post-disposal RSS/PSS across repeated churn, preserved playfield lifecycle and physics behavior, and no material latency/throughput regression. No live production experiments without explicit approval.
Checklist
0 of 0 completeNo checklist items.
- Area
- Project Rubi-Ka
- Project
- engines
- Kind
- Bug
- Priority
- High
- Task ID
tsk_pwwgzyv3kz- Updated