Repository navigation
Conversation
…s (X2W_TRACY) X2W_ALLOC, X2W_FREE and X2W_PLOT join the zone macros. XMemAlloc/XMemFree feed the pool "XMemAlloc", each instrumented DLL reports its operator new/delete as "<target> C++ heap", and XMemVirtualAlloc commits are a cumulative plot (the title frees those ranges with Win32 calls). Without the option the macros are no-ops. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The opt-in build works — I configured and built it — and this PR changes six files with no test at all
Two things that were worth checking and that do hold:
What has no assertionThe PR touches six files and adds no fixture. Under the default build the following are therefore unconstrained:
The last one is the one I would not want to be wrong silently: What a check would costThe four If the intent is that this file is measurement-only and stays untested, EnvironmentWindows 11 build 26300, MSVC x64 via the Build Tools dev shell, CMake/Ninja. Tracy v0.15.0 was fetched by the configure AI-assisted. |
tedin7
left a comment
There was a problem hiding this comment.
Review of head e36ad70 (10 commits behind main; the PR's own diff is 6 files, +63/-8). Code review only; this is a Windows-only C++ change and I did not build it here.
Read through, no defects found in the logic:
src/xmem_shim.cppXMemAlloc: the permissive-fallback branch now assignsallocation = local_alloc(...)and skips the graphics-trackingelse if, which matches the old early return. The tracking and release-on-failure path is unchanged.X2W_FREEruns beforelocal_free, so the pool sees every freed block once.src/startup_stubs/tracy_new.cpp:bytes ? bytes : 1,_aligned_mallocpaired with_aligned_free, null-safe deletes. Array, sized and nothrow forms forward to these four.src/xmem_mapped_pages.cpp: the plot counter is cumulative by design (comment explains why), guarded by#if X2W_TRACY.profile_zone.h: with the option off the three macros are((void)0).
Why I am not taking this to a merge:
- No test guards anything new.
tracy_new.cppand the plot counter only compile withX2W_TRACY=ON, which no CTest target uses (see ChazY11's comment above; I agree with the table there). XMemAllocis a runtime path of the stand-ins in the default build, and its control flow was rewritten. The existing xmem tests cover the allocator, but none of them exercises the permissive fallback together with the newX2W_ALLOCplacement, and there is no negative control.- The PR body says no capture was taken, so the pools showing up in Tracy is unmeasured.
To make it mergeable: add a small fixture that builds tracy_new.cpp with X2W_TRACY undefined-safe stubs and checks new(0), aligned new/delete and delete(nullptr) under the debug heap, plus a mutation (_aligned_free -> free) that fails it. Or, if the file is meant to stay measurement-only and untested, say so in docs/startup-runtime.md. The merge stays with @R0Y00 / MasterDomino.
Commands run:
git diff --check origin/main...HEAD-> cleanpython3 tests/docs_links_check.py-> self-test passedpython3 tests/bidi_controls_check.py-> no bidirectional controlsrgovertests/for sibling xmem tests (xmem_commit_protection_check, era_heap_check, xmem_lazy_imports_check): none covers the changed XMemAlloc ordering.
AI-assisted; commands listed were executed locally.
What
X2W_TRACY=ONbuilds now report memory to the Tracy profiler, next to the existing zones:XMemAlloc/XMemFreeare reported as the named poolXMemAlloc.operator new/delete, plain and aligned) as a pool named<target> C++ heap, through one new file,src/startup_stubs/tracy_new.cpp, added to those targets only when the option is on.XMemVirtualAlloccommits are a cumulative plot (bytes).profile_zone.hgainsX2W_ALLOC,X2W_FREEandX2W_PLOT. With the option off they expand to((void)0),tracy_new.cppis not compiled, and no stand-in changes behavior.Why
Long runs of the stand-ins grow in committed memory, and the log alone does not say which allocator owns the growth. Tracy's memory view gives live size and allocation counts per pool over time.
Tests
What stays unverified
VirtualAllocblocks made by drivers are outside these pools.TRACY_NO_CALLSTACKstays set, so allocations carry no call stacks.AI-assisted.
🤖 Generated with Claude Code