[PR #2895] [MERGED] Core: Pooled Memory Fixes #3060

Closed
opened 2026-02-27 22:02:17 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/2895
Author: @StevenMiller123
Created: 5/10/2025
Status: Merged
Merged: 5/11/2025
Merged by: @squidbus

Base: mainHead: pooled-memory-updates


📝 Commits (10+)

📊 Changes

3 files changed (+110 additions, -64 deletions)

View changed files

📝 src/core/libraries/kernel/memory.cpp (+17 -10)
📝 src/core/memory.cpp (+91 -53)
📝 src/core/memory.h (+2 -1)

📄 Description

This introduces a handful of bug fixes designed to make our memory pool implementation more hardware-accurate. All of these changes are based exclusively on hardware tests, so there may be some niche edge cases I've misinterpreted.

Changes:

  • Don't coalesce PoolReserved memory
  • Coalesce PoolCommitted memory - Removed change because of Windows.
  • Fix another case of potential vma_map corruption introduced by #2080
  • Handle sceKernelMemoryPoolReserve calls with addrIn = 0
  • Update sceKernelMemoryPoolExpand with the updated logic used by sceKernelAllocateDirectMemory
  • Handle sceKernelMemoryPoolExpand errors when there's not enough space to expand.
  • Properly unmap before any type of memory reservations.
  • Properly handle sceKernelMemoryPoolCommit address restrictions.
  • Properly handle pooled memory budgets, and the error conditions surrounding these.

This should address #1485, though it doesn't affect any games I own.
Unreal Engine games using memory pools seem to be unaffected by my changes.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/shadps4-emu/shadPS4/pull/2895 **Author:** [@StevenMiller123](https://github.com/StevenMiller123) **Created:** 5/10/2025 **Status:** ✅ Merged **Merged:** 5/11/2025 **Merged by:** [@squidbus](https://github.com/squidbus) **Base:** `main` ← **Head:** `pooled-memory-updates` --- ### 📝 Commits (10+) - [`4f1a8c5`](https://github.com/shadps4-emu/shadPS4/commit/4f1a8c57fc073fddd5f1b222fdfcae7a9714010a) Update sceKernelMemoryPoolExpand - [`f7aee88`](https://github.com/shadps4-emu/shadPS4/commit/f7aee889de76812f530051108263aaeb856a2fa9) Update MemoryPoolReserve - [`74bb0c1`](https://github.com/shadps4-emu/shadPS4/commit/74bb0c1a983cdba1de1d5a643eedd3b31d9f48d9) Don't coalesce PoolReserved areas. - [`e434bc0`](https://github.com/shadps4-emu/shadPS4/commit/e434bc081148732fb606b0671a57e4efd966416c) Update PoolCommit - [`1cca6c4`](https://github.com/shadps4-emu/shadPS4/commit/1cca6c4119ddc80cc9efc9c638c412db84c8d3d4) Formatting - [`33cb81b`](https://github.com/shadps4-emu/shadPS4/commit/33cb81b9d1a7e0c36e874e4d7cfb169cf6551add) Adjust fixed PoolReserve path - [`5a455c9`](https://github.com/shadps4-emu/shadPS4/commit/5a455c97def0ed5da665e83a1ea1802a48ff77d4) Remove phys_base modifications - [`21e8fb2`](https://github.com/shadps4-emu/shadPS4/commit/21e8fb2e2007acd0a830fcdcaae0b889a4ba5684) Use VMAHandle.Contains() - [`fdff2fc`](https://github.com/shadps4-emu/shadPS4/commit/fdff2fc47b6a06a18c6bbc99b934ead467afba9f) Update memory.cpp - [`1dcdc53`](https://github.com/shadps4-emu/shadPS4/commit/1dcdc53ca4d0f38a007fdaa195620d3b41570f04) Remove unnecessary code ### 📊 Changes **3 files changed** (+110 additions, -64 deletions) <details> <summary>View changed files</summary> 📝 `src/core/libraries/kernel/memory.cpp` (+17 -10) 📝 `src/core/memory.cpp` (+91 -53) 📝 `src/core/memory.h` (+2 -1) </details> ### 📄 Description This introduces a handful of bug fixes designed to make our memory pool implementation more hardware-accurate. All of these changes are based exclusively on hardware tests, so there may be some niche edge cases I've misinterpreted. Changes: - Don't coalesce PoolReserved memory - ~Coalesce PoolCommitted memory~ - Removed change because of Windows. - Fix another case of potential `vma_map` corruption introduced by #2080 - Handle `sceKernelMemoryPoolReserve` calls with `addrIn = 0` - Update `sceKernelMemoryPoolExpand` with the updated logic used by `sceKernelAllocateDirectMemory` - Handle `sceKernelMemoryPoolExpand` errors when there's not enough space to expand. - Properly unmap before any type of memory reservations. - Properly handle `sceKernelMemoryPoolCommit` address restrictions. - Properly handle pooled memory budgets, and the error conditions surrounding these. This should address #1485, though it doesn't affect any games I own. Unreal Engine games using memory pools seem to be unaffected by my changes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 22:02:17 +03:00
Sign in to join this conversation.
No milestone
No project
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.

Dependencies

No dependencies set.

Reference
starred/shadPS4#3060
No description provided.