Repository navigation
[M2-TILE-01 fix] Resolve the zero-alloc failure site to module+symbol (dladdr) - #77
Merged
Merged
Conversation
… (dladdr) The macOS arm64 lane failed TileMapZeroAlloc.DeclareLoopAllocatesNothing with 48 heap blocks during the 1000-frame window (every other tree and macOS Intel pass; the whole engine window path is allocation-free by construction). The first-site address alone is not actionable — resolve it to module + symbol with dladdr (POSIX lanes; raw address on MSVC, which has no dladdr). Also: the loop's status checks were silent returns — a failed frame left the test passing without evidence; they are now ASSERTs.
… lazy init Root cause (via the dladdr diagnostic from the previous commit): the first offending site in the 48/8/6-block macOS failures (arm64 AND Intel, run to run) is inside the QuartzCore system framework - a one-time lazy initialization of a framework-internal hash table that lands asynchronously in whichever armed window catches it after the GL/GLFW suites earlier in this binary load the graphics framework chain. The engine window is provably alloc-free (every Linux tree passes at 0 with the same code; every in-window engine path is pre-allocated by construction). Fix: two-stage proof. The settle stage re-runs the 1000-frame loop under armed windows until a CLEAN window is observed (bounded to 4), absorbing the one-time init; the proof stage then pins the steady-state zero-allocation property (FR-2.2). A genuine engine-side first-frame allocation cannot be hidden: the SpriteBatcher* suites (earlier in the same binary) already exercise create/beginFrame/add/build under their own armed windows.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Master CI (run 37506547846) was red on macOS arm64 (AppleClang):
TileMapZeroAlloc.DeclareLoopAllocatesNothingcounted 48 heap blocks during the 1000-framebeginFrame/declareTo/buildwindow. macOS Intel later failed the same test too (6 blocks) — every other lane in every run was green.Root cause
Commit 1 adds
dladdrresolution of the first offending site to the failure message (module + symbol on POSIX, raw address on MSVC). The macOS lanes then reported it:i.e. a one-time lazy initialization of a hash table inside the QuartzCore system framework, landing asynchronously in whichever armed window catches it after the GL/GLFW suites earlier in the same test binary load the graphics framework chain. It is not engine code:
create;declareTois pure index math).Fix (commit 2)
Two-stage proof, matching what FR-2.2 actually pins ("no per-frame allocation" — steady state):
A genuine engine-side first-frame allocation cannot be hidden: the
SpriteBatcher*suites (earlier in the same binary) already exercisecreate/beginFrame/add/buildunder their own armed windows, and no settle iteration can absorb a recurring allocation — it would fall through to the proof and fail with the resolved site.Also: the loop's status checks were silent
returns (a failed frame let the test pass with no evidence) — they are nowASSERTs.Verification
ctest -R tilemapgreen; include + determinism lints OK.ci:macos— one P0 OS per PR by cadence): macOS arm64 + macOS Intel + all platform-independent checks green (run 37514531413). The Linux lanes run on the merge lane per the PRD §14 cadence ("all per merge" via ci.yml).