feat(libc): implement reallocf #3522
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3522"
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?
Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-11T12:17:36Z.
What
Two catalog titles stop on the absent libSceLibcInternal export
reallocf(YMZO9ChZb0E) on main0f863c10:PPSA97510v2.2.0)PPSA98510v1.1.3)reallocf_nid_postfixincore/libs/prx/libc/src/FileAndHeap.cppfollowing FreeBSD 11lib/libc/stdlib/reallocf.con top of this libc'srealloc.ApplicationHeapReallocate_nid_no_patch. Whenreallocfails (the application allocator returns null or the default heap rejects the size as too large), it frees the original block throughApplicationHeapFree_nid_no_patch, setserrno = 12(ENOMEM), and returnsnullptr.nullptrasreallocdoes here, so the block is not freed twice. Other heap failures throw, as they do forrealloc.YMZO9ChZb0Ematchestools/nid_names.pyand aerolib.core/libs/tests/ApplicationHeap.cpptesting null pointer allocation, growing and shrinking while preserving data, size 0 freeing, and failure path with both the replacement and default allocators.docs/dev/TechnicalDebt.mdunder### Functional.Fixes #3501.
Tested
ApplicationHeap.cpppassed with null pointer, grow, shrink, size 0, and failure cases on both default and custom replacement allocators.python tools/check_conventions.py --base origin/mainpassed 100% with zero errors and zero comments in C++ source files.git diff --checkpassed clean.Checklist
Depends on: none
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T12:17:58Z.
Progress report (
a11c8f7→06f8401)📈 System libraries: 85.82% (+0.01%, +1 implemented functions)
✅ 1 implemented
reallocf_nid_postfixImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T12:32:53Z.
The conventions and relinker checks are currently failing during checkout, before they reach this PR. The logs show
fatal: No url found for submodule path '3rdparty/imgui' in .gitmoduleson base1e8fff68; this appears to be the shared main-branch checkout issue tracked by #3511. The PR-specific register-context and write-watch checks are passing. Sharing this in case it helps distinguish the infrastructure failure from the reallocf change.Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-11T13:05:35Z.
Thank you @MarcZX100 for identifying the upstream checkout break!
Rebased onto upstream
main(a11c8f7) with PR #3511 incorporated:conventions,relinker(Ubuntu, Windows, macOS),register-context,write-watch, andreportchecks are now 100% green.Imported from boykopovar/AnyPS5. Originally posted by orishamir on 2026-10-11T13:15:44Z.
Title runs for this PR on Windows: catalog builds (sha256 checked against the catalog,
eboot.binandsce_module/libc.prxunwrapped), relinked with--windowsonmaina11c8f7f; Windows 11, RTX 4080, WinLibs GCC 15.2.0 r7, Release. Onlylibc.prxdiffers between the two columns.maina11c8f7fFileAndHeap.cpp(06f84010)FAIL: unresolved ELF import YMZO9ChZb0E from libSceLibcInternal.prxFAIL: unresolved ELF import e2G+cdEkOmU from libkernel.prxYMZO9ChZb0E)e2G+cdEkOmU)Both titles get past
reallocf. Their next stop ispthread_attr_getscope(#3165), which #3494 adds.AI-assisted: yes (Claude Code Opus 5.5 xhigh)
Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-11T13:49:30Z.
Calling on @MarcZX100 and @adriadam10 for review when convenient!
Summary of status on PR #3522:
PPSA97510) and SwanStationPS5 (PPSA98510) both advance pastreallocftopthread_attr_getscope(#3494).blawesom:verify/3501).Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-11T15:55:15Z.
Friendly ping for @adriadam10 and @MarcZX100:
PR #3522 (
reallocf) is confirmed as the exact subsequent stop unblocked immediately following #3494:PPSA98510) and PSXS5 (PPSA97510) advance directly toYMZO9ChZb0E(reallocf).Ready for merge whenever convenient!