runtime: establish contracts for the XMem default allocation pair #875
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows#875
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@R0Y00 on GitHub · 2026-11-23 15:14 UTC · original
Refs #870, #126, #132.
The startup preflight found imports for
XMemAllocDefaultandXMemFreeDefault. The project's desktopxmem.dllalready providesXMemAllocandXMemFree. Establish the ABI and observable behavior of the default allocation pair, including ownership, size, alignment, allocation failure and the matching free operation.Acceptance
pe_map, including successful allocation and forced failure with cleanup.Available to claim. Comment with your environment and related work. Keep candidate binaries, dumps and private logs local.
@R0Y00 on GitHub · 2026-11-23 15:18 UTC · original
The public SlimEra header at 912bb11 gives one ABI candidate:
PVOID WINAPI XMemAllocDefault(SIZE_T, ULONGLONG)andvoid WINAPI XMemFreeDefault(PVOID, ULONGLONG). This is an independent reimplementation declaration. The target behavior for allocation failure, alignment and matching free still needs its own evidence.For the source-built test,
tests/cpu/shim_startup_check.pyalready checks named imports and compares native launch withpe_map. A small variant for this pair can reuse that setup. Please keep the ABI evidence and what the Windows shim actually does separate in the results, especially for failure and cleanup.@rasptum on GitHub · 2026-11-23 15:19 UTC · original
Claiming this.
xmem.dllgains the named exportsXMemAllocDefault(SIZE_T, ULONGLONG) -> PVOIDandXMemFreeDefault(PVOID, ULONGLONG), matching the public declarations in SlimEraera.hand WinDurangokernelx.h. Both use the sameera_heappolicy asXMemAlloc/XMemFree.xmem.dll. It runs under a normal Windows launch and underpe_map_run, and the two exit codes are compared: a heap block and a graphics block (alignment, zero fill, writes), a forced failure (reserved bit and zero size return null) with cleanup, and release checked byVirtualQuery. Negative controls: a variant that skips the free, a variant whose forced failure is unforced, and an unresolved-import diagnostic when the provider lacks the pair.devandreleasepresets.src/xmem_shim*,src/era_heap*orpe_map. Hooks (XMemSetAllocationHooks) are out of scope.AI-assisted (Claude Code).
@R0Y00 on GitHub · 2026-11-23 15:41 UTC · original
Thanks for taking the native/mapped comparison. #879 now owns the desktop exports, so please build the fixture on that change and keep the follow-up to the test and evidence. Check that the EXE's PE import table contains both names and that the mapped resolver observes both names.
VirtualQuerycan confirm the graphics VA release. Use a separate ownership check for the heap block, where the containing heap region can stay committed after free. Please distinguish rejected inputs from any induced allocator failure.@rasptum on GitHub · 2026-11-23 16:58 UTC · original
Result: #913. It changes only tests, CMake and docs, on top of #879.
Tested: commit
24f4297onorigin/main02db28b. Windows 10 Pro 10.0.19045.6466, MSVC 19.44.35207.1 x64. Synthetic words only.cpu_native_xmem_default_pairstarts each of four source-built EXEs under the Windows loader and underpe_map_run. The exits match in all four.The checks you asked for:
pe_import_names:pefilefindsxmem.dll!XMemAllocDefaultandxmem.dll!XMemFreeDefaultby name in every EXE.mapped_resolver_names: thepe_mapresolver callback is asked for both names, plus the five other imports, and nothing else. Nope_map.cppchange.graphics_release_virtualquery:VirtualQueryreports the graphics VA asMEM_FREEafterXMemFreeDefault.heap_release_ownership: a separate ownership check,tests/cpu/heap_probe.cpp, locks andHeapWalks every process heap. Before free a busy entry contains the heap block; after free none does.rejected_inputsvsinduced_failure:VirtualAllocleaves a nonzero last error. A control allocation then succeeds.Negative controls, all matching under both loaders:
skip_gpu_freegives0xf14(graphics release).skip_heap_freegives0xf15(heap ownership).uninducedgives0xf0f(induced failure).Results: dev and release each pass 20/20 (
era_heap,era_physical,desktop_memory_query, thexmem_shimset and both XMem EXE pairs). The new test also passed 5/5 repeats in each preset. The form-coverage, docs-links and bidi checks pass.Kept separate: the ABI candidate is SlimEra
era.hat 912bb11, an independent reimplementation. The measured results describe only the Windows shim. The last-error split between rejected input and induced failure is observed desktop behavior. Console failure, alignment and release under hooks remain open.AI-assisted (Claude Code).
@R0Y00 on GitHub · 2026-11-23 17:13 UTC · original
Completed by #879 and #913. The named desktop exports and the source-built comparison are on main. Windows and pe_map both observe the expected names, successful heap/graphics allocation, input refusal versus induced allocation failure, and matching release. The graphics address is checked with VirtualQuery, and the heap block with a separate ownership probe. Each missing-export and release mutation was verified in Debug and Release. This records the tested desktop shim behavior. Console-specific allocation guarantees remain unverified.