feat(libc): implement reallocf #1767

Closed
MarcZX10 wants to merge 1 commit from upstream-pr/1767 into main
MarcZX10 commented 2026-10-08 18:46:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-08T18:46:14Z.


What

Implement reallocf using the guest application allocator. On allocation failure, free the original allocation, set ENOMEM, and return null; preserve zero-size reallocation behavior. The missing import is listed in #1578.

Tested

Linux: built application_heap_tests; ctest --test-dir build -R ^application_heap_(replacement|default)$ --output-on-failure passed, including a deterministic allocator-failure case. python3 tools/check_conventions.py --base upstream/main passed. Windows and PS5 hardware not tested.

Checklist

  • Based on current main; no other open PR implements this function
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; no stub added
  • No notes, investigation files or images added
  • No third-party code added
  • Generic behavior
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4791333102 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1767). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-08T18:46:14Z. --- ### What Implement `reallocf` using the guest application allocator. On allocation failure, free the original allocation, set `ENOMEM`, and return null; preserve zero-size reallocation behavior. The missing import is listed in #1578. ### Tested Linux: built `application_heap_tests`; `ctest --test-dir build -R ^application_heap_(replacement|default)$ --output-on-failure` passed, including a deterministic allocator-failure case. `python3 tools/check_conventions.py --base upstream/main` passed. Windows and PS5 hardware not tested. ### Checklist - [x] Based on current `main`; no other open PR implements this function - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw; no stub added - [x] No notes, investigation files or images added - [x] No third-party code added - [x] Generic behavior - [x] Depends on: none - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-08 19:08:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-08T19:08:00Z.


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
#1611 core/libs/tests/ApplicationHeap.cpp L270
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6067104713 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1767#issuecomment-6067104713). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-08T19:08:00Z. --- <!-- 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 | |---|---|---|---| | #1611 | `core/libs/tests/ApplicationHeap.cpp` [L270](https://github.com/boykopovar/AnyPS5/blob/b858fdc48e29c3ab7476782199d8a41999d46d59/core/libs/tests/ApplicationHeap.cpp#L270) | | |
oneandonlydean commented 2026-10-08 19:22:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-08T19:22:23Z.


No title reaches reallocf on main yet: the homebrew audit lists the import, but those titles stop earlier at other missing imports. Closing for now; reopen when it's a title's next stop on main, with the log line.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6067363099 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1767#issuecomment-6067363099). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-08T19:22:23Z. --- No title reaches `reallocf` on main yet: the homebrew audit lists the import, but those titles stop earlier at other missing imports. Closing for now; reopen when it's a title's next stop on main, with the log line.

Pull request closed

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!1767
No description provided.