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

Merged
Celegans12 merged 1 commit from upstream-pr/650 into main 2026-10-05 19:03:54 +00:00
Celegans12 commented 2026-10-05 10:55:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-05T10:55:48Z.


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.
  • #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 #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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4743829683 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/650). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-05T10:55:48Z. --- ### 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. - #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 #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 - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-05 13:32:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-05T13:32:27Z.


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
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5995513467 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/650#issuecomment-5995513467). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-05T13:32:27Z. --- <!-- pr-overlap --> 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](https://github.com/boykopovar/AnyPS5/blob/78c17a1d478a2113203106d57d9a2b2245e754bd/core/libs/prx/libkernel/DirectMemory/DirectMemory.cpp#L228-L229) | | |
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!650
No description provided.