Add GuestHeap size-classed reuse pool + oversized-allocation free-list
GuestHeap previously bump-allocated any request >64KiB and never reclaimed it on free() - a real, sustained gameplay session eventually exhausted the arena (traced live to two separate crashes: onCreate never completing, and a NULL-vector dereference in sub_4BA588 caused by a failed ~175KB allocation going unchecked by the real EA code). Widen the existing O(1) size-class free list (already used for <=64KiB requests) to cover the whole arena instead of adding a second reuse mechanism next to it - oversized allocations now pool and reclaim the same way small ones already did. Add matching desktop tests (guest_heap_test.cpp, run via run_heap_tests.sh) covering the exact failing size from the crash log and a sustained alloc/free cycle in an arena too small to survive without reclaim. Verified live on device: the crash is gone across a full 10-minute session with sustained GLES rendering throughout. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
# Desktop-only GuestHeap test harness (see guest_heap_test.cpp's own top
|
||||
# comment) - no Android, no Unicorn, no APK, no device. Compiles
|
||||
# guest_heap.cpp directly against the host's own C++ compiler and runs the
|
||||
# resulting binary. Fast feedback loop for changes to the guest heap
|
||||
# allocator before ever touching a device.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
SRC_DIR="src/main/cpp/emu"
|
||||
OUT="${TMPDIR:-/tmp}/guest_heap_test"
|
||||
|
||||
c++ -std=c++17 -O0 -g -Wall \
|
||||
"$SRC_DIR/guest_heap.cpp" \
|
||||
"$SRC_DIR/tests/guest_heap_test.cpp" \
|
||||
-I"$SRC_DIR" \
|
||||
-o "$OUT"
|
||||
|
||||
"$OUT"
|
||||
Reference in New Issue
Block a user