feat(libc): implement malloc_stats_fast through the application allocator #2039
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2039"
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 Aryansh1520 on 2026-10-09T05:36:57Z.
What
A title that replaces the allocator through its libc parameters also supplies
malloc_stats_fastin that table, at the entry already recorded inMallocReplace. PPSA28997 (God of War Sons of Sparta) calls it.malloc_stats_fastis now exported and forwarded to the title's function, under the same checks and callback scope as the other application-heap calls. Without a replacement allocator that provides it, the call throws.Tested
tools/check_conventions.py --base origin/mainandtools/pr_overlap.py --branchpass.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T05:57:53Z.
The callback path follows the existing heap lock and callback-scope pattern. Please add coverage for forwarding a supplied slot-8 callback and for the missing-allocator/missing-slot error paths; these are the new behavior and currently have no regression test. GitHub reports no checks on this head, so please get the relevant CI jobs running before merge.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T09:22:54Z.
Same as #2038: the log line where PPSA28997 stops on main at
malloc_stats_fast, please.Imported from boykopovar/AnyPS5. Originally posted by Aryansh1520 on 2026-10-09T10:36:55Z.
Added coverage in
bdeef942(application_heap_tests):malloc_stats_fastpasses the caller's pointer through, including null, and returns the callback's result.malloc_stats_fastbefore any allocator is registered throws.application_heap_default) and with a replacement allocator whose slot 8 is null (newapplication_heap_missing_stats). In the second case the other heap calls still work and no callback runs.Removing the forwarding, the missing-slot check or the callback scope each makes a test fail.
Where PPSA28997 stops:
malloc_stats_fastis imported byeboot.elf. When it was a not-implemented stub in my local build, the title aborted during startup:Main doesn't export it at all (
KuOuD58hqn4). On main (as of Oct 8) the title stops earlier, atLTov9gMEqCU(std::ios_base::_Addstd, #545).The build workflows on this head are waiting for approval to run (fork PR).
Imported from boykopovar/AnyPS5. Originally posted by Aryansh1520 on 2026-10-09T10:53:17Z.
Moved the
malloc_stats_fastchecks out ofApplicationHeap.cppinto their own test,ApplicationHeapStats.cpp, in7fc6fac1. It runs in three modes:application_heap_stats,application_heap_stats_defaultandapplication_heap_stats_missing. This PR no longer touches the file #1900 changes. The coverage is the same as before: forwarding, the nested-call rejection, no allocator, the default allocator and a missing slot 8. Removing the forwarding, the slot check or the callback scope still fails a test. I also checked that the PR merges cleanly with #1900 and thatmalloc_stats_fastonly uses state #1900 keeps.Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-09T16:07:04Z.
Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head
7fc6fac1, merged ontomaind70b8998together with #1324, #2193 and #2247.application_heap_stats,application_heap_stats_default,application_heap_stats_missing.sceLibcUnknown_BnMAMrsfVWo, under the NID thatmalloc_stats_fastpatches to. With both merged,libc.prxfails withduplicate patched export name: BnMAMrsfVWo; I've noted it on #2193.No title was run.
🤖 Addressed by Claude Code
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T21:58:28Z.
Checked on Linux (GCC), merged onto current main: build + ctest green (532/532); the three
application_heap_stats*tests pass and do not link without the change. Slot 8 ofMallocReplacematchesmalloc_stats_fastin KytyPS5's replace table, and the checks and callback scope match the other application-heap calls. Windows run by @popcoder565 also passes. Merging.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T22:16:02Z.
Progress report (
d70b899→7fc6fac)📈 System libraries: 84.7% (+0.01%, +1 implemented functions)
✅ 1 implemented
malloc_stats_fast_nid_postfix