Skip to content

fix(libkernel): state the size of a direct memory backing Windows cannot create - #650

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
Celegans12:fix/windows-direct-memory-commit
Oct 5, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
Celegans12:fix/windows-direct-memory-commit

Conversation

@Celegans12

@Celegans12 Celegans12 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

What

On Windows, CreateDirectMemoryBacking backs each direct memory allocation with a fully committed page-file section (CreateFileMappingW). When the commit limit cannot cover it, the error was only create direct memory backing: Insufficient system resources exist to complete the requested service, with no size.

  • The error now reads create direct memory backing of 0x<n> bytes (<m> MiB): <Windows error>, MiB rounded up. It still throws; allocation is unchanged.
  • USAGE.md (Runtime layout) says that up to 13824 MiB (DIRECT_MEMORY_SIZE) is committed at allocation, and to enlarge the page file or close other applications.
  • fix(libc): track writes to singly mapped direct memory without faults on Windows #637 (opened after this branch) creates the section with SEC_RESERVE and commits direct memory only as it is mapped. If it merges first, creating the section no longer fails on commit, so this message matters only until then; the commit limit must then cover the mapped pages, and the USAGE.md note still applies. This branch will then be rebased onto fix(libc): track writes to singly mapped direct memory without faults on Windows #637, dropping or moving the message hunk as the maintainers prefer.
  • Windows-only: the Linux memfd_create path is unchanged, so a reviewer on Linux cannot run it.

PPSA26344 v1.008 (APS5_TRACE_MEMORY) allocated 0x26c00000, 0x27e00000 and 0xd3400000 bytes; the next allocation threw the old message with 32.5 of the host's 40.7 GB commit limit in use before launch. With 21.6 GB of commit free, the same build got past it.

#550 changes LinuxProtFromSce in the same file; #461 and #600 add other USAGE.md sections. None of them conflicts with this branch's hunks.

Tested

  • Windows 11, MinGW-w64 GCC 15.2.0: configure -DBUILD_TESTING=ON, full build, --target libs.
  • 284/284 tests pass (ctest --output-on-failure)
  • No new ctest case: the error needs the host commit limit to be exhausted.
  • A standalone program with the new formatting (error 1450, size 0xd3400000) prints create direct memory backing of 0xd3400000 bytes (3380 MiB): Insufficient system resources exist to complete the requested service.
  • PPSA26344 v1.008: the old message was seen before this change; the new message was not observed at runtime.
  • Not tested: Linux (CI), console behaviour.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#637 core/libs/prx/libkernel/DirectMemory/DirectMemory.cpp L228-229

…not create

On Windows each direct memory allocation is backed by a page-file
section that CreateFileMappingW commits in full. When the system commit
limit cannot cover it, the title stopped with "create direct memory
backing: Insufficient system resources exist to complete the requested
service", which did not say how much was requested.

The error now states the requested size in bytes and MiB, and the
runtime layout notes in USAGE.md describe the commit requirement and
the page file. Allocation behaviour is unchanged: committing at
allocation matches the console, where allocated direct memory is
always backed by physical memory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Celegans12
Celegans12 force-pushed the fix/windows-direct-memory-commit branch from 601e184 to 62c70fb Compare October 5, 2026 15:52
@oneandonlydean
oneandonlydean merged commit 25c4a94 into boykopovar:main Oct 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants