Skip to content

fix(libc): optionally reclaim and lazily commit small heap spans - #12849

Draft
Bram910 wants to merge 5 commits into
boykopovar:mainfrom
Bram910:fix/libc-reclaim-empty-small-spans
Draft

Bram910 wants to merge 5 commits into
boykopovar:mainfrom
Bram910:fix/libc-reclaim-empty-small-spans

Conversation

@Bram910

@Bram910 Bram910 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

What

On main, a small size class commits a full 1 MiB span on its first allocation and never releases its spans after free. Add the opt-in presence flag APS5_RECLAIM_SMALL_HEAP to track occupancy and free lists per span, release completely empty excess spans, and retain one warm span per class. Each span reserves 1 MiB but starts with 64 KiB committed; commitment doubles as the bump pointer crosses the committed prefix.

With the flag unset, the small-block allocation/free retention path, allocation headers and exported API stay unchanged. ArenaHeap::Get() now has process lifetime even when the flag is unset: its metadata and large-block-cache containers are no longer destroyed at exit. APS5_RECLAIM_SMALL_HEAP is a presence flag; even 0 enables it.

Safety integration: #11468 has merged and is included through current main 4f41f4c375. Its allocation metadata rejects a second free before span occupancy changes. The new double-free fixture leaves another allocation live, rejects a second free, checks accounting and the surviving payload, then frees it; it runs with reclamation both unset and enabled. The former missing-prerequisite warning has been removed from the environment reference and debt entry.

On Linux and macOS, arenaAllocate(SpanBytes, ...) already claims the entire span in the arena's used-range bookkeeping. The initial arena mapping and GuestArenaReset supply fresh anonymous PROT_NONE pages; lazy growth only needs GuestArenaSetProtection/mprotect to make the next prefix writable. It does not need another used-range claim or a replacement mapping. In particular, MarkUsedForCommit accepts the original span start but rejects an interior subrange of that existing reservation, so using GuestArenaCommit for subsequent growth would conflict with the span's claim. Successfully reset pages are demand-zero when made accessible again. The Windows path continues to use GuestArenaCommit. Reclamation resets the mapping, invalidates guest-allocation caches and releases the arena reservation. Failed growth rolls back the new portion without touching live objects; a cleanup failure quarantines the span. Known gaps and the flag are documented.

Draft: a complete, repeated current-main/current-PR title comparison remains outstanding. The historical compatibility-build gameplay pair below is unfavorable and has dropped detailed trace events. Contributor macOS support-branch validation is attributed below. No GTA memory reduction or FPS improvement is claimed. More frequent commit/decommit can hurt throughput or cause stutter; the flag stays off by default.

Tested

Windows 11 Pro 10.0.26200, Ryzen 9 7950X, WinLibs GCC 15.2 UCRT, Release. Rebased onto 5454cd2e455994d992aca39335ce60507eeda1eb. Windows heap suite: 35/35 passed after rebase (log below). Clean original-main baseline: 13/13 existing heap tests passed.

Ubuntu 22.04 under WSL, GCC 11.4, -fsanitize=undefined -fno-sanitize-recover=all: 22/22 focused allocator cases pass, with 20/20 previous-commit controls and no UBSan diagnostic. This directly compiles the actual GuestHeap, GuestArena, GuestAllocations and GuestWriteWatch sources with the fixture; it is not a full Linux libc build. The allocator, fixture and libc CMake sources are byte-identical before and after rebase. Main has not changed GuestHeap, GuestArena, GuestAllocations or GuestWriteWatch between the measured baseline and the rebase target.

The fixtures exercise default retention, live objects across spans, randomized reuse, alignment/realignment, zero-size realloc, threads, small/large thresholds, initial and growing commit rollback, invalidation-failure quarantine, allocation leases and disabled write watching. Main fails the reclamation assertion, and the previous allocator fails the sparse-commitment assertion, with candidate passing both.

Synthetic measurements used identical fixture/launcher binaries across each pair and fresh processes in alternating order (baseline/candidate/candidate/baseline/baseline/candidate). All exited normally under a 1 GiB job cap. Every live payload byte was checked. These measure native allocator workloads, not a title.

Workload / metric Baseline Change
Two successive 128 MiB phases: peak heap commitment 300 MiB (main) 150.5 MiB
Same workload: committed heap after both phases freed 300 MiB (main) 2 MiB
Sparse, 33 live objects across 31 classes: heap commitment 31 MiB (previous allocator) 1.9375 MiB
Sparse: median process peak job commitment 33.832 MiB 4.742 MiB
Sparse: median peak resident working set 6.473 MiB 6.461 MiB
Dense: median whole-process duration, including startup 416 ms (previous allocator) 432 ms

Commitment is distinct from resident RAM: the sparse result mostly avoids backing commitment for previously untouched pages. The short dense runs show a timing cost and do not establish title frame-time behavior.

Measurement pins: main ba5b5330b37724bca4b99f30faab504653635a04; previous allocator 8368fd23f2dd882023edba86cad340eab9174d36; final geometric-growth candidate f2ab45695767b8c086ca3d06e83ae49725728a8d before the source-equivalent rebase. Their rebased equivalents in this PR are 5d22a65fa7 (first reclamation) and be5c729ccc (geometric growth). The earlier main/first-reclamation comparison measured 307.375 to 159.297 MiB median peak job commitment. That earlier six-run batch is separate from the later sparse/dense batch; their totals are not added together.

Reproduction:

cmake --build build --target guest_heap_small_spans_tests application_heap_tests application_heap_stats_tests guest_heap_rounding_tests guest_heap_report_for_game_tests guest_heap_trace_info_tests -j1
ctest --test-dir build -R 'application_heap|guest_heap' -V

Duplicate search and integration: checked open allocator PRs #11468, #11850, #11870 and #12239. Each merges into the current main, then merges cleanly with this branch in git merge-tree previews; no dependency or duplicate implementation was found. The standard tools/pr_overlap.py --branch fix/libc-reclaim-empty-small-spans was attempted but could not execute because gh is absent. These direct checks do not replace the complete automated overlap scan.

Review follow-up (2026-11-03)

Integrated current main 4f41f4c375, including #11468, with a clean merge. Windows 10.0.26200.9457, Ryzen 9 7950X, WinLibs GCC 15.2 Release: 39/39 focused application/guest heap tests pass after integration, including reclamation enabled/unset double-free and churn cases. check_conventions.py --base origin/main and git diff --check pass.

Requested churn measurement: 256 allocations of 4096 payload bytes (1 MiB live payload), write and check every payload byte, free all blocks, repeat. Four warm-up cycles, then 128 timed cycles. Same executable and allocator source with the presence flag unset versus =1; six fresh-process samples per mode, ABBA order repeated three times, APS5_HEAP_CACHE_MIB=0. This compares the two paths of this branch, rather than claiming a new measurement of an unmodified main executable.

Median per 1 MiB cycle Flag unset Flag enabled
Allocate, touch, verify and free 337.55 µs 456.61 µs

Reclamation is 35.3% slower in this small repeated workload. Its one warm span does not eliminate the cost when rounded blocks occupy more than one span. The result reinforces keeping the flag opt-in; it establishes no title frame-time benefit. The previous dense/sparse measurements below remain historical measurements at their explicitly named revisions.

The process-lifetime heap is deliberate for both flag states: exit handlers can allocate after a function-local static heap would have been destroyed. imellag's macOS validation reports base 46/47 versus this PR 69/69 on their named macOS support branch, and guest_heap_lifetime passing 3/3 with this PR versus a destroyed-mutex error on base. Those are contributor results on a support branch, not a new local macOS run. The LeakSanitizer results below supersede the earlier untested leak-check status. Heap metadata and retained large-cache containers intentionally remain reachable until process exit.

No title exhausting commitment has been demonstrated by this PR. The attempted fresh instrumented GTA diagnostic stopped on its existing low-memory guard before reaching the scene. The older compatibility-build gameplay pair is now audited and disclosed below; it is not a current-main/current-PR performance validation. Original saves and runtime were restored and hash-verified. No repeatable title RAM reduction or FPS improvement is claimed.

Readiness audit: leak check and existing gameplay evidence (2026-11-03)

Decision: retain draft and keep the flag off by default. The existing gameplay pair and the churn measurement do not support recommending reclamation. No new title run was performed for this audit: the available physical memory was about 11.5 GiB against the existing 28 GiB capture admission requirement, and the user chose to use the recorded gameplay evidence for now.

LeakSanitizer

Current head aad9fecb1312d8a2235465c8466e8c07b41f274c, Ubuntu under WSL, GCC 11.4.0, -std=c++20 -O1 -g -fsanitize=leak. Directly compiled the actual GuestHeap.cpp, GuestArena.cpp, GuestAllocations.cpp, GuestWriteWatch.cpp and allocator fixture; this is not a full Linux libc or title build.

  • 26/26 allocator cases pass with no LeakSanitizer report: 10 with the flag unset and 16 with it enabled. These include live allocations across spans, reuse, alignment, threads, boundaries, rollback, pinning, churn and double-free rejection; enabled cases additionally exercise reclamation, quarantine, phases, sparse commitment and growth failure.
  • 2/2 exit-time lifetime cases pass, flag unset and enabled, using GuestHeapLifetime.cpp: an exit handler allocates, verifies and frees on a worker thread after the ordinary static-finalization point.
  • LSAN_OPTIONS=exitcode=23 was used. A separate deliberate 12,345-byte host allocation leak is detected and exits 23, confirming the checker is active.
  • Limit: LeakSanitizer checks unreachable host allocations. Reachable process-lifetime metadata/cache state and the custom guest virtual-memory mappings are not proved absent by this check; retained commitment is separately measured by the fixtures.

Historical GTA V opening-room pair

Recorded 2026-10-29, GTA V PPSA04263 01.010.002, stationary prologue opening room at the “Go to the guard” objective. Ryzen 9 7950X, RTX 3080, NVIDIA 610.47, Windows 10.0.26200, guest resolution 3840×2160. Other user workloads remained running.

Control 9b2dc9f49a3ed3f7d513f246032de6d4fdb96c34; candidate f7254105b8df483d53eeb8488112f4e145c84608. This is a compatibility integration, not clean upstream main, and predates the current PR head. Rechecked Git provenance: the two arms differ only in this PR's five files, and the historical candidate's GuestHeap.cpp is byte-identical to published revision be5c729ccc.

Re-ran the saved-data analysis: GPU/title/version/resolution match, initial cache and save manifests match, and the recorded environment differs only by APS5_RECLAIM_SMALL_HEAP=1. Both measured runs exited normally with code 0, with no job-cap event or low-memory stop. Logs were not redirected. Original runtime and saves were restored and hash-verified after those runs.

Metric Control Reclamation enabled
Frame p50 90.178 ms 157.199 ms
Frame p99 108.240 ms 182.904 ms
Worst frame 154.413 ms 248.610 ms
GPU busy per present 32.487 ms 32.752 ms
Median private commit 16,542.832 MiB 16,505.613 MiB
Median working set 14,619.254 MiB 14,602.994 MiB

In this pair, p50 frame time is 74.3% higher, while median private commit is only 37.219 MiB lower and working set 16.260 MiB lower. This is an unfavorable observation, not a repeatable regression estimate or a demonstrated memory benefit.

Limitations: candidate ran before control; only one pair exists. Both detailed event buffers overflowed (trace_dropped=true), with the queue-worker buffer filling after 8.282 s for candidate and 7.872 s for control. The available frame summaries cover the named 300:20 window, but detailed timelines are incomplete. The 76 memory samples per arm cover 300–320 s after process resume, while trace time starts at first present. The pair therefore does not supply the complete reverse-order current-main/current-PR comparison needed to qualify readiness.

Original recorded frame summaries (both explicitly report dropped trace events)
{"commit":"9b2dc9f49a3e","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"300:20"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 610.47","os":"Windows 10.0.26200","cpu":"AMD Ryzen 9 7950X 16-Core Processor","cpu_threads":32,"memory_mib":64608,"title_id":"PPSA04263","title":"Grand Theft Auto V","content_version":"01.010.002","resolution":"3840x2160","window":{"spec":"seconds 300:20","first_present":6817,"ms":20072.886},"presents":222,"frame_ms":{"p50":90.178,"p90":96.258,"p99":108.240,"max":154.413},"gpu_busy_ms_per_present":32.487,"worker_busy_pct":{"queue worker 0x0":98.393},"top_phases_ms_per_frame":{"Driver.Packet":85.225,"Graphics.Draw":73.832,"Driver.Packet.draw":70.048,"Driver.Draw":69.723,"Graphics.Draw.draw_and_resource_release":65.387,"Driver.Draw.draw_enqueued":41.722,"Driver.Draw.shader_compile_and_link":22.205,"Shader.DrawStage":17.529},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":7.872,"events_lost":409185,"totals_full":false},"draw committer":{"events_full_after_s":18.617,"events_lost":20748,"totals_full":false}},"trace":"aps5-trace-9b2dc9f49a3e-77056.json.gz"}
{"commit":"f7254105b8df","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_RECLAIM_SMALL_HEAP":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"300:20"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 610.47","os":"Windows 10.0.26200","cpu":"AMD Ryzen 9 7950X 16-Core Processor","cpu_threads":32,"memory_mib":64608,"title_id":"PPSA04263","title":"Grand Theft Auto V","content_version":"01.010.002","resolution":"3840x2160","window":{"spec":"seconds 300:20","first_present":6389,"ms":20116.142},"presents":129,"frame_ms":{"p50":157.199,"p90":172.327,"p99":182.904,"max":248.610},"gpu_busy_ms_per_present":32.752,"worker_busy_pct":{"queue worker 0x0":98.507},"top_phases_ms_per_frame":{"Driver.Packet":147.814,"Graphics.Draw":127.259,"Driver.Packet.draw":123.597,"Driver.Draw":122.966,"Graphics.Draw.draw_and_resource_release":111.049,"Driver.Draw.draw_enqueued":74.694,"Driver.Draw.shader_compile_and_link":37.608,"Shader.DrawStage":28.872},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":8.282,"events_lost":384526,"totals_full":false},"draw committer":{"events_full_after_s":19.882,"events_lost":3271,"totals_full":false}},"trace":"aps5-trace-f7254105b8df-84280.json.gz"}

Private diagnostic command dumps, proprietary binaries, shader caches and saves are not included in this description.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a (libc allocator only)
  • AI-assisted: yes
Raw protected measurements: final geometric-growth candidate vs previous allocator
{
  "base": "8368fd23f2dd882023edba86cad340eab9174d36",
  "candidate_state": "clean local commit; not pushed",
  "environment": {
    "APS5_RECLAIM_SMALL_HEAP": "1",
    "APS5_HEAP_CACHE_MIB": "0"
  },
  "order": [
    "previous",
    "candidate",
    "candidate",
    "previous",
    "previous",
    "candidate"
  ],
  "measurements": {
    "sparse": {
      "previous": {
        "runs": [
          {
            "exit_code": 0,
            "stop_reason": "process-exited",
            "elapsed_ms": 173,
            "peak_sampled_private_bytes": 761856,
            "peak_working_set_bytes": 7323648,
            "peak_job_commit_bytes": 35491840,
            "job_limit_bytes": 1073741824,
            "gameplay": false,
            "heap": {
              "before": 0,
              "live_system": 32505856,
              "after_free": 32505856,
              "inuse": 0
            }
          },
          {
            "exit_code": 0,
            "stop_reason": "process-exited",
            "elapsed_ms": 34,
            "peak_sampled_private_bytes": 77824,
            "peak_working_set_bytes": 6787072,
            "peak_job_commit_bytes": 35475456,
            "job_limit_bytes": 1073741824,
            "gameplay": false,
            "heap": {
              "before": 0,
              "live_system": 32505856,
              "after_free": 32505856,
              "inuse": 0
            }
          },
          {
            "exit_code": 0,
            "stop_reason": "process-exited",
            "elapsed_ms": 41,
            "peak_sampled_private_bytes": 77824,
            "peak_working_set_bytes": 6778880,
            "peak_job_commit_bytes": 35454976,
            "job_limit_bytes": 1073741824,
            "gameplay": false,
            "heap": {
              "before": 0,
              "live_system": 32505856,
              "after_free": 32505856,
              "inuse": 0
            }
          }
        ],
        "median_peak_job_commit_mib": 33.83203125,
        "median_peak_working_set_mib": 6.47265625,
        "median_elapsed_ms": 41
      },
      "candidate": {
        "runs": [
          {
            "exit_code": 0,
            "stop_reason": "process-exited",
            "elapsed_ms": 151,
            "peak_sampled_private_bytes": 765952,
            "peak_working_set_bytes": 7299072,
            "peak_job_commit_bytes": 5013504,
            "job_limit_bytes": 1073741824,
            "gameplay": false,
            "heap": {
              "before": 0,
              "live_system": 2031616,
              "after_free": 2031616,
              "inuse": 0
            }
          },
          {
            "exit_code": 0,
            "stop_reason": "process-exited",
            "elapsed_ms": 38,
            "peak_sampled_private_bytes": 77824,
            "peak_working_set_bytes": 6770688,
            "peak_job_commit_bytes": 4968448,
            "job_limit_bytes": 1073741824,
            "gameplay": false,
            "heap": {
              "before": 0,
              "live_system": 2031616,
              "after_free": 2031616,
              "inuse": 0
            }
          },
          {
            "exit_code": 0,
            "stop_reason": "process-exited",
            "elapsed_ms": 41,
            "peak_sampled_private_bytes": 77824,
            "peak_working_set_bytes": 6774784,
            "peak_job_commit_bytes": 4972544,
            "job_limit_bytes": 1073741824,
            "gameplay": false,
            "heap": {
              "before": 0,
              "live_system": 2031616,
              "after_free": 2031616,
              "inuse": 0
            }
          }
        ],
        "median_peak_job_commit_mib": 4.7421875,
        "median_peak_working_set_mib": 6.4609375,
        "median_elapsed_ms": 41
      }
    },
    "dense": {
      "previous": {
        "runs": [
          {
            "exit_code": 0,
            "stop_reason": "process-exited",
            "elapsed_ms": 416,
            "peak_sampled_private_bytes": 142200832,
            "peak_working_set_bytes": 169123840,
            "peak_job_commit_bytes": 167022592,
            "job_limit_bytes": 1073741824,
            "gameplay": false,
            "heap": {
              "requested_each_phase": 134217728,
              "before": 0,
              "after_first_free": 1048576,
              "peak_system": 158334976,
              "second_live_system": 157286400,
              "after_second_free": 2097152,
              "inuse": 0
            }
          },
          {
            "exit_code": 0,
            "stop_reason": "process-exited",
            "elapsed_ms": 449,
            "peak_sampled_private_bytes": 146382848,
            "peak_working_set_bytes": 169119744,
            "peak_job_commit_bytes": 166993920,
            "job_limit_bytes": 1073741824,
            "gameplay": false,
            "heap": {
              "requested_each_phase": 134217728,
              "before": 0,
              "after_first_free": 1048576,
              "peak_system": 158334976,
              "second_live_system": 157286400,
              "after_second_free": 2097152,
              "inuse": 0
            }
          },
          {
            "exit_code": 0,
            "stop_reason": "process-exited",
            "elapsed_ms": 384,
            "peak_sampled_private_bytes": 151937024,
            "peak_working_set_bytes": 169115648,
            "peak_job_commit_bytes": 167010304,
            "job_limit_bytes": 1073741824,
            "gameplay": false,
            "heap": {
              "requested_each_phase": 134217728,
              "before": 0,
              "after_first_free": 1048576,
              "peak_system": 158334976,
              "second_live_system": 157286400,
              "after_second_free": 2097152,
              "inuse": 0
            }
          }
        ],
        "median_peak_job_commit_mib": 159.2734375,
        "median_peak_working_set_mib": 161.28515625,
        "median_elapsed_ms": 416
      },
      "candidate": {
        "runs": [
          {
            "exit_code": 0,
            "stop_reason": "process-exited",
            "elapsed_ms": 482,
            "peak_sampled_private_bytes": 143601664,
            "peak_working_set_bytes": 169119744,
            "peak_job_commit_bytes": 166481920,
            "job_limit_bytes": 1073741824,
            "gameplay": false,
            "heap": {
              "requested_each_phase": 134217728,
              "before": 0,
              "after_first_free": 1048576,
              "peak_system": 157810688,
              "second_live_system": 157286400,
              "after_second_free": 2097152,
              "inuse": 0
            }
          },
          {
            "exit_code": 0,
            "stop_reason": "process-exited",
            "elapsed_ms": 432,
            "peak_sampled_private_bytes": 134107136,
            "peak_working_set_bytes": 169123840,
            "peak_job_commit_bytes": 166486016,
            "job_limit_bytes": 1073741824,
            "gameplay": false,
            "heap": {
              "requested_each_phase": 134217728,
              "before": 0,
              "after_first_free": 1048576,
              "peak_system": 157810688,
              "second_live_system": 157286400,
              "after_second_free": 2097152,
              "inuse": 0
            }
          },
          {
            "exit_code": 0,
            "stop_reason": "process-exited",
            "elapsed_ms": 394,
            "peak_sampled_private_bytes": 162414592,
            "peak_working_set_bytes": 169119744,
            "peak_job_commit_bytes": 166486016,
            "job_limit_bytes": 1073741824,
            "gameplay": false,
            "heap": {
              "requested_each_phase": 134217728,
              "before": 0,
              "after_first_free": 1048576,
              "peak_system": 157810688,
              "second_live_system": 157286400,
              "after_second_free": 2097152,
              "inuse": 0
            }
          }
        ],
        "median_peak_job_commit_mib": 158.7734375,
        "median_peak_working_set_mib": 161.28515625,
        "median_elapsed_ms": 432
      }
    }
  },
  "binary_sha256": {
    "previous": {
      "SmallSpanFixture.exe": "79cfca8d0f61ef18f4114651707aa01493e6473b21c05c4255d98eb6f4c263eb",
      "ProtectedIncrementalReplay.exe": "b455dd2f26ac984ec8c1f0bc13ec67e693b0bf1c0e427e561d48977b7f3f3247",
      "libc.prx": "fda917e096c901b22bab2f49d0a737528e2e68f5a1327ff4c3e2dd88d9da2a14"
    },
    "candidate": {
      "SmallSpanFixture.exe": "79cfca8d0f61ef18f4114651707aa01493e6473b21c05c4255d98eb6f4c263eb",
      "ProtectedIncrementalReplay.exe": "b455dd2f26ac984ec8c1f0bc13ec67e693b0bf1c0e427e561d48977b7f3f3247",
      "libc.prx": "1b9fe864fdf99ae7cd111b18175b3d65d4034d697aa80e731a0fa2fa0f7075b3"
    }
  },
  "candidate_commit": "f2ab45695767b8c086ca3d06e83ae49725728a8d",
  "source_sha256": {
    "core/libs/prx/libc/src/GuestHeap.cpp": "0e829cba4a7123033b8f8a66a83c17c5e530f04c46eb559b66b49eb231221079",
    "core/libs/tests/GuestHeapSmallSpans.cpp": "4f728b2f49b61af5dd7880bec30031707b8ea6a1ff2e157a14626b91501284cc",
    "core/libs/prx/libc/CMakeLists.txt": "ec0f990029a64c66039ec2c914dafbbec946219ed3c60843cbbb117deaaaa8f1"
  }
}
Linux focused UBSan cases (22/22)
g++ (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0
DEFAULT default
{"before":0,"allocated":158334976,"after_free":158334976,"inuse":0,"invalidated_spans":0}
small heap span tests passed
DEFAULT live
small heap span tests passed
DEFAULT reuse
small heap span tests passed
DEFAULT alignment
small heap span tests passed
DEFAULT threads
small heap span tests passed
DEFAULT boundaries
small heap span tests passed
DEFAULT rollback
small heap span tests passed
DEFAULT pinning
small heap span tests passed
ENABLED reclaim
{"before":0,"allocated":157810688,"after_free":1048576,"inuse":0,"invalidated_spans":150}
small heap span tests passed
ENABLED live
small heap span tests passed
ENABLED reuse
small heap span tests passed
ENABLED alignment
small heap span tests passed
ENABLED threads
small heap span tests passed
ENABLED boundaries
small heap span tests passed
ENABLED rollback
small heap span tests passed
ENABLED quarantine
small heap span tests passed
ENABLED pinning
small heap span tests passed
ENABLED phases
{"requested_each_phase":134217728,"before":0,"after_first_free":1048576,"peak_system":157810688,"second_live_system":157286400,"after_second_free":2097152,"inuse":0}
small heap span tests passed
ENABLED sparse
{"before":0,"live_system":2031616,"after_free":2031616,"inuse":0}
small heap span tests passed
ENABLED growth-rollback
small heap span tests passed
ENABLED growth-quarantine
small heap span tests passed
UNWATCHED reclaim
{"before":0,"allocated":157810688,"after_free":1048576,"inuse":0,"invalidated_spans":150}
small heap span tests passed
22 Linux UBSan allocator cases passed

Previous allocator Linux UBSan controls (20/20)
g++ (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0
DEFAULT default
{"before":0,"allocated":158334976,"after_free":158334976,"inuse":0,"invalidated_spans":0}
small heap span tests passed
DEFAULT live
small heap span tests passed
DEFAULT reuse
small heap span tests passed
DEFAULT alignment
small heap span tests passed
DEFAULT threads
small heap span tests passed
DEFAULT boundaries
small heap span tests passed
DEFAULT rollback
small heap span tests passed
DEFAULT pinning
small heap span tests passed
ENABLED reclaim
{"before":0,"allocated":158334976,"after_free":1048576,"inuse":0,"invalidated_spans":150}
small heap span tests passed
ENABLED live
small heap span tests passed
ENABLED reuse
small heap span tests passed
ENABLED alignment
small heap span tests passed
ENABLED threads
small heap span tests passed
ENABLED boundaries
small heap span tests passed
ENABLED rollback
small heap span tests passed
ENABLED quarantine
small heap span tests passed
ENABLED pinning
small heap span tests passed
ENABLED phases
{"requested_each_phase":134217728,"before":0,"after_first_free":1048576,"peak_system":158334976,"second_live_system":157286400,"after_second_free":2097152,"inuse":0}
small heap span tests passed
ENABLED growth-rollback
small heap span tests passed
UNWATCHED reclaim
{"before":0,"allocated":158334976,"after_free":1048576,"inuse":0,"invalidated_spans":150}
small heap span tests passed
20 prior-commit Linux UBSan allocator controls passed

Sparse negative control on previous allocator
{"before":0,"live_system":32505856,"after_free":32505856,"inuse":0}
lightly used classes commit whole spans

Rebased Windows heap CTest log (35/35)
UpdateCTestConfiguration  from :<workspace>/AnyPS5-submit/build-win/DartConfiguration.tcl
Test project <workspace>/AnyPS5-submit/build-win
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 646
      Start 646: application_heap_replacement

646: Test command: <workspace>\AnyPS5-submit\build-win\tests\application_heap_tests.exe
646: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
646: Environment variable modifications: 
646:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
646: Test timeout computed to be: 10000000
 1/35 Test #646: application_heap_replacement ................   Passed    0.05 sec
test 647
      Start 647: application_heap_invalid_metadata

647: Test command: <workspace>\AnyPS5-submit\build-win\tests\application_heap_tests.exe "invalid"
647: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
647: Environment variable modifications: 
647:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
647: Test timeout computed to be: 10000000
 2/35 Test #647: application_heap_invalid_metadata ...........   Passed    0.02 sec
test 648
      Start 648: application_heap_default

648: Test command: <workspace>\AnyPS5-submit\build-win\tests\application_heap_tests.exe "default"
648: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
648: Environment variable modifications: 
648:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
648: Test timeout computed to be: 10000000
 3/35 Test #648: application_heap_default ....................   Passed    0.02 sec
test 649
      Start 649: application_heap_exit_order

649: Test command: <workspace>\AnyPS5-submit\build-win\tests\application_heap_tests.exe "exit-order"
649: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
649: Environment variable modifications: 
649:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
649: Test timeout computed to be: 10000000
 4/35 Test #649: application_heap_exit_order .................   Passed    0.02 sec
test 650
      Start 650: application_heap_scripting

650: Test command: <workspace>\AnyPS5-submit\build-win\tests\application_heap_tests.exe "scripting"
650: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
650: Environment variable modifications: 
650:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
650: Test timeout computed to be: 10000000
 5/35 Test #650: application_heap_scripting ..................   Passed    0.02 sec
test 651
      Start 651: application_heap_lazy

651: Test command: <workspace>\AnyPS5-submit\build-win\tests\application_heap_tests.exe "lazy"
651: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
651: Environment variable modifications: 
651:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
651: Test timeout computed to be: 10000000
 6/35 Test #651: application_heap_lazy .......................   Passed    0.02 sec
test 652
      Start 652: application_heap_without_parameters

652: Test command: <workspace>\AnyPS5-submit\build-win\tests\application_heap_tests.exe "none"
652: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
652: Environment variable modifications: 
652:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
652: Test timeout computed to be: 10000000
 7/35 Test #652: application_heap_without_parameters .........   Passed    0.02 sec
test 654
      Start 654: application_heap_stats

654: Test command: <workspace>\AnyPS5-submit\build-win\tests\application_heap_stats_tests.exe
654: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
654: Environment variable modifications: 
654:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
654: Test timeout computed to be: 10000000
 8/35 Test #654: application_heap_stats ......................   Passed    0.06 sec
test 655
      Start 655: application_heap_stats_default

655: Test command: <workspace>\AnyPS5-submit\build-win\tests\application_heap_stats_tests.exe "default"
655: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
655: Environment variable modifications: 
655:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
655: Test timeout computed to be: 10000000
 9/35 Test #655: application_heap_stats_default ..............   Passed    0.02 sec
test 656
      Start 656: application_heap_stats_missing

656: Test command: <workspace>\AnyPS5-submit\build-win\tests\application_heap_stats_tests.exe "missing"
656: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
656: Environment variable modifications: 
656:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
656: Test timeout computed to be: 10000000
10/35 Test #656: application_heap_stats_missing ..............   Passed    0.01 sec
test 661
      Start 661: guest_heap_report_for_game

661: Test command: <workspace>\AnyPS5-submit\build-win\tests\guest_heap_report_for_game_tests.exe
661: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
661: Environment variable modifications: 
661:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
661: Test timeout computed to be: 10000000
11/35 Test #661: guest_heap_report_for_game ..................   Passed    0.07 sec
test 662
      Start 662: guest_heap_rounding_overflow

662: Test command: <workspace>\AnyPS5-submit\build-win\tests\guest_heap_rounding_tests.exe
662: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
662: Environment variable modifications: 
662:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
662: Test timeout computed to be: 10000000
12/35 Test #662: guest_heap_rounding_overflow ................   Passed    0.12 sec
test 668
      Start 668: guest_heap_small_spans_default

668: Test command: <workspace>\AnyPS5-submit\build-win\tests\guest_heap_small_spans_tests.exe "default"
668: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
668: Environment variables: 
668:  APS5_HEAP_CACHE_MIB=0
668: Environment variable modifications: 
668:  APS5_RECLAIM_SMALL_HEAP=unset:
668:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
668: Test timeout computed to be: 30
668: {"before":0,"allocated":158334976,"after_free":158334976,"inuse":0,"invalidated_spans":0}
668: small heap span tests passed
13/35 Test #668: guest_heap_small_spans_default ..............   Passed    0.19 sec
test 669
      Start 669: guest_heap_small_spans_reclaim

669: Test command: <workspace>\AnyPS5-submit\build-win\tests\guest_heap_small_spans_tests.exe "reclaim"
669: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
669: Environment variables: 
669:  APS5_HEAP_CACHE_MIB=0
669:  APS5_RECLAIM_SMALL_HEAP=1
669: Environment variable modifications: 
669:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
669: Test timeout computed to be: 30
669: {"before":0,"allocated":157810688,"after_free":1048576,"inuse":0,"invalidated_spans":150}
669: small heap span tests passed
14/35 Test #669: guest_heap_small_spans_reclaim ..............   Passed    0.18 sec
test 670
      Start 670: guest_heap_small_spans_live

670: Test command: <workspace>\AnyPS5-submit\build-win\tests\guest_heap_small_spans_tests.exe "live"
670: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
670: Environment variables: 
670:  APS5_HEAP_CACHE_MIB=0
670:  APS5_RECLAIM_SMALL_HEAP=1
670: Environment variable modifications: 
670:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
670: Test timeout computed to be: 30
670: small heap span tests passed
15/35 Test #670: guest_heap_small_spans_live .................   Passed    0.05 sec
test 671
      Start 671: guest_heap_small_spans_reuse

671: Test command: <workspace>\AnyPS5-submit\build-win\tests\guest_heap_small_spans_tests.exe "reuse"
671: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
671: Environment variables: 
671:  APS5_HEAP_CACHE_MIB=0
671:  APS5_RECLAIM_SMALL_HEAP=1
671: Environment variable modifications: 
671:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
671: Test timeout computed to be: 30
671: small heap span tests passed
16/35 Test #671: guest_heap_small_spans_reuse ................   Passed    0.09 sec
test 672
      Start 672: guest_heap_small_spans_alignment

672: Test command: <workspace>\AnyPS5-submit\build-win\tests\guest_heap_small_spans_tests.exe "alignment"
672: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
672: Environment variables: 
672:  APS5_HEAP_CACHE_MIB=0
672:  APS5_RECLAIM_SMALL_HEAP=1
672: Environment variable modifications: 
672:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
672: Test timeout computed to be: 30
672: small heap span tests passed
17/35 Test #672: guest_heap_small_spans_alignment ............   Passed    0.04 sec
test 673
      Start 673: guest_heap_small_spans_threads

673: Test command: <workspace>\AnyPS5-submit\build-win\tests\guest_heap_small_spans_tests.exe "threads"
673: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
673: Environment variables: 
673:  APS5_HEAP_CACHE_MIB=0
673:  APS5_RECLAIM_SMALL_HEAP=1
673: Environment variable modifications: 
673:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
673: Test timeout computed to be: 30
673: small heap span tests passed
18/35 Test #673: guest_heap_small_spans_threads ..............   Passed    0.05 sec
test 674
      Start 674: guest_heap_small_spans_boundaries

674: Test command: <workspace>\AnyPS5-submit\build-win\tests\guest_heap_small_spans_tests.exe "boundaries"
674: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
674: Environment variables: 
674:  APS5_HEAP_CACHE_MIB=0
674:  APS5_RECLAIM_SMALL_HEAP=1
674: Environment variable modifications: 
674:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
674: Test timeout computed to be: 30
674: small heap span tests passed
19/35 Test #674: guest_heap_small_spans_boundaries ...........   Passed    0.20 sec
test 675
      Start 675: guest_heap_small_spans_rollback

675: Test command: <workspace>\AnyPS5-submit\build-win\tests\guest_heap_small_spans_tests.exe "rollback"
675: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
675: Environment variables: 
675:  APS5_HEAP_CACHE_MIB=0
675:  APS5_RECLAIM_SMALL_HEAP=1
675: Environment variable modifications: 
675:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
675: Test timeout computed to be: 30
675: small heap span tests passed
20/35 Test #675: guest_heap_small_spans_rollback .............   Passed    0.02 sec
test 676
      Start 676: guest_heap_small_spans_quarantine

676: Test command: <workspace>\AnyPS5-submit\build-win\tests\guest_heap_small_spans_tests.exe "quarantine"
676: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
676: Environment variables: 
676:  APS5_HEAP_CACHE_MIB=0
676:  APS5_RECLAIM_SMALL_HEAP=1
676: Environment variable modifications: 
676:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
676: Test timeout computed to be: 30
676: small heap span tests passed
21/35 Test #676: guest_heap_small_spans_quarantine ...........   Passed    0.03 sec
test 677
      Start 677: guest_heap_small_spans_pinning

677: Test command: <workspace>\AnyPS5-submit\build-win\tests\guest_heap_small_spans_tests.exe "pinning"
677: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
677: Environment variables: 
677:  APS5_HEAP_CACHE_MIB=0
677:  APS5_RECLAIM_SMALL_HEAP=1
677: Environment variable modifications: 
677:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
677: Test timeout computed to be: 30
677: small heap span tests passed
22/35 Test #677: guest_heap_small_spans_pinning ..............   Passed    0.02 sec
test 678
      Start 678: guest_heap_small_spans_phases

678: Test command: <workspace>\AnyPS5-submit\build-win\tests\guest_heap_small_spans_tests.exe "phases"
678: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
678: Environment variables: 
678:  APS5_HEAP_CACHE_MIB=0
678:  APS5_RECLAIM_SMALL_HEAP=1
678: Environment variable modifications: 
678:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
678: Test timeout computed to be: 30
678: {"requested_each_phase":134217728,"before":0,"after_first_free":1048576,"peak_system":157810688,"second_live_system":157286400,"after_second_free":2097152,"inuse":0}
678: small heap span tests passed
23/35 Test #678: guest_heap_small_spans_phases ...............   Passed    0.34 sec
test 679
      Start 679: guest_heap_small_spans_sparse

679: Test command: <workspace>\AnyPS5-submit\build-win\tests\guest_heap_small_spans_tests.exe "sparse"
679: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
679: Environment variables: 
679:  APS5_HEAP_CACHE_MIB=0
679:  APS5_RECLAIM_SMALL_HEAP=1
679: Environment variable modifications: 
679:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
679: Test timeout computed to be: 30
679: {"before":0,"live_system":2031616,"after_free":2031616,"inuse":0}
679: small heap span tests passed
24/35 Test #679: guest_heap_small_spans_sparse ...............   Passed    0.02 sec
test 680
      Start 680: guest_heap_small_spans_growth-rollback

680: Test command: <workspace>\AnyPS5-submit\build-win\tests\guest_heap_small_spans_tests.exe "growth-rollback"
680: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
680: Environment variables: 
680:  APS5_HEAP_CACHE_MIB=0
680:  APS5_RECLAIM_SMALL_HEAP=1
680: Environment variable modifications: 
680:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
680: Test timeout computed to be: 30
680: small heap span tests passed
25/35 Test #680: guest_heap_small_spans_growth-rollback ......   Passed    0.02 sec
test 681
      Start 681: guest_heap_small_spans_growth-quarantine

681: Test command: <workspace>\AnyPS5-submit\build-win\tests\guest_heap_small_spans_tests.exe "growth-quarantine"
681: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
681: Environment variables: 
681:  APS5_HEAP_CACHE_MIB=0
681:  APS5_RECLAIM_SMALL_HEAP=1
681: Environment variable modifications: 
681:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
681: Test timeout computed to be: 30
681: small heap span tests passed
26/35 Test #681: guest_heap_small_spans_growth-quarantine ....   Passed    0.02 sec
test 682
      Start 682: guest_heap_small_spans_default_live

682: Test command: <workspace>\AnyPS5-submit\build-win\tests\guest_heap_small_spans_tests.exe "live"
682: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
682: Environment variables: 
682:  APS5_HEAP_CACHE_MIB=0
682: Environment variable modifications: 
682:  APS5_RECLAIM_SMALL_HEAP=unset:
682:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
682: Test timeout computed to be: 30
682: small heap span tests passed
27/35 Test #682: guest_heap_small_spans_default_live .........   Passed    0.04 sec
test 683
      Start 683: guest_heap_small_spans_default_reuse

683: Test command: <workspace>\AnyPS5-submit\build-win\tests\guest_heap_small_spans_tests.exe "reuse"
683: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
683: Environment variables: 
683:  APS5_HEAP_CACHE_MIB=0
683: Environment variable modifications: 
683:  APS5_RECLAIM_SMALL_HEAP=unset:
683:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
683: Test timeout computed to be: 30
683: small heap span tests passed
28/35 Test #683: guest_heap_small_spans_default_reuse ........   Passed    0.10 sec
test 684
      Start 684: guest_heap_small_spans_default_alignment

684: Test command: <workspace>\AnyPS5-submit\build-win\tests\guest_heap_small_spans_tests.exe "alignment"
684: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
684: Environment variables: 
684:  APS5_HEAP_CACHE_MIB=0
684: Environment variable modifications: 
684:  APS5_RECLAIM_SMALL_HEAP=unset:
684:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
684: Test timeout computed to be: 30
684: small heap span tests passed
29/35 Test #684: guest_heap_small_spans_default_alignment ....   Passed    0.05 sec
test 685
      Start 685: guest_heap_small_spans_default_threads

685: Test command: <workspace>\AnyPS5-submit\build-win\tests\guest_heap_small_spans_tests.exe "threads"
685: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
685: Environment variables: 
685:  APS5_HEAP_CACHE_MIB=0
685: Environment variable modifications: 
685:  APS5_RECLAIM_SMALL_HEAP=unset:
685:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
685: Test timeout computed to be: 30
685: small heap span tests passed
30/35 Test #685: guest_heap_small_spans_default_threads ......   Passed    0.06 sec
test 686
      Start 686: guest_heap_small_spans_default_boundaries

686: Test command: <workspace>\AnyPS5-submit\build-win\tests\guest_heap_small_spans_tests.exe "boundaries"
686: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
686: Environment variables: 
686:  APS5_HEAP_CACHE_MIB=0
686: Environment variable modifications: 
686:  APS5_RECLAIM_SMALL_HEAP=unset:
686:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
686: Test timeout computed to be: 30
686: small heap span tests passed
31/35 Test #686: guest_heap_small_spans_default_boundaries ...   Passed    0.20 sec
test 687
      Start 687: guest_heap_small_spans_default_rollback

687: Test command: <workspace>\AnyPS5-submit\build-win\tests\guest_heap_small_spans_tests.exe "rollback"
687: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
687: Environment variables: 
687:  APS5_HEAP_CACHE_MIB=0
687: Environment variable modifications: 
687:  APS5_RECLAIM_SMALL_HEAP=unset:
687:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
687: Test timeout computed to be: 30
687: small heap span tests passed
32/35 Test #687: guest_heap_small_spans_default_rollback .....   Passed    0.02 sec
test 688
      Start 688: guest_heap_small_spans_default_pinning

688: Test command: <workspace>\AnyPS5-submit\build-win\tests\guest_heap_small_spans_tests.exe "pinning"
688: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
688: Environment variables: 
688:  APS5_HEAP_CACHE_MIB=0
688: Environment variable modifications: 
688:  APS5_RECLAIM_SMALL_HEAP=unset:
688:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
688: Test timeout computed to be: 30
688: small heap span tests passed
33/35 Test #688: guest_heap_small_spans_default_pinning ......   Passed    0.02 sec
test 689
      Start 689: guest_heap_small_spans_unwatched

689: Test command: <workspace>\AnyPS5-submit\build-win\tests\guest_heap_small_spans_tests.exe "reclaim"
689: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
689: Environment variables: 
689:  APS5_HEAP_CACHE_MIB=0
689:  APS5_RECLAIM_SMALL_HEAP=1
689:  APS5_NO_WRITE_WATCH=1
689: Environment variable modifications: 
689:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
689: Test timeout computed to be: 30
689: {"before":0,"allocated":157810688,"after_free":1048576,"inuse":0,"invalidated_spans":150}
689: small heap span tests passed
34/35 Test #689: guest_heap_small_spans_unwatched ............   Passed    0.18 sec
test 690
      Start 690: guest_heap_trace_info

690: Test command: <workspace>\AnyPS5-submit\build-win\tests\guest_heap_trace_info_tests.exe
690: Working Directory: <workspace>/AnyPS5-submit/build-win/core/libs/prx/libc
690: Environment variable modifications: 
690:  PATH=path_list_prepend:<workspace>/AnyPS5-submit/build-win/core/libs/libs/unpatched
690: Test timeout computed to be: 10000000
35/35 Test #690: guest_heap_trace_info .......................   Passed    0.06 sec

The following tests passed:
	application_heap_replacement
	application_heap_invalid_metadata
	application_heap_default
	application_heap_exit_order
	application_heap_scripting
	application_heap_lazy
	application_heap_without_parameters
	application_heap_stats
	application_heap_stats_default
	application_heap_stats_missing
	guest_heap_report_for_game
	guest_heap_rounding_overflow
	guest_heap_small_spans_default
	guest_heap_small_spans_reclaim
	guest_heap_small_spans_live
	guest_heap_small_spans_reuse
	guest_heap_small_spans_alignment
	guest_heap_small_spans_threads
	guest_heap_small_spans_boundaries
	guest_heap_small_spans_rollback
	guest_heap_small_spans_quarantine
	guest_heap_small_spans_pinning
	guest_heap_small_spans_phases
	guest_heap_small_spans_sparse
	guest_heap_small_spans_growth-rollback
	guest_heap_small_spans_growth-quarantine
	guest_heap_small_spans_default_live
	guest_heap_small_spans_default_reuse
	guest_heap_small_spans_default_alignment
	guest_heap_small_spans_default_threads
	guest_heap_small_spans_default_boundaries
	guest_heap_small_spans_default_rollback
	guest_heap_small_spans_default_pinning
	guest_heap_small_spans_unwatched
	guest_heap_trace_info

100% tests passed, 0 tests failed out of 35

Total Test time (real) =   3.72 sec

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@Bram910 This reads correctly as an opt-in change: with APS5_RECLAIM_SMALL_HEAP unset the small-block Allocate and Free run the same code as main, each span is looked up under its size class lock, a block is checked against its span (inside the bump range, aligned to the class size, live not zero) before it is freed, the empty-span release resets, invalidates and then releases in that order, and the default and default_* tests pin the unset behaviour. Two optional points:

  1. With the flag on, a double free of a small block lowers live twice, so a span that still holds live blocks can reach live == 0 and be reset and released under them. On main the same double free corrupts the free list, so this is not new, but reclaiming makes its effect larger. fix(libc): validate guest heap block headers before freeing #11468 rejects a second free before it reaches rawFree (the block record is gone), so the combination is safe once it lands; could the description say that the flag should be enabled only with it, or could you add a test that documents what a double free does with the flag on?
  2. On Linux and macOS the lazy commit calls GuestArenaSetProtection (a mprotect), whereas the existing commit() uses GuestArenaCommit, which also calls MarkUsedForCommit and maps the range with mmap. The pages come out zeroed either way (a fresh or reset range is a PROT_NONE mapping), but could you say why SetProtection is enough there, in particular that arenaAllocate already marks the whole span used so the arena's bookkeeping is unchanged?

Also noted for the record: the unset path changes in one way, ArenaHeap::Get() is now allocated with new and never destroyed, which also removes the exit-time destruction of the large-block cache; APS5_RECLAIM_SMALL_HEAP=0 enables the flag (presence flag, as the table says); and the title frame-time and macOS results you list as outstanding should be in before the flag is recommended to anyone.

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1896 docs/dev/ENVIRONMENT.md
PR 4472 docs/dev/ENVIRONMENT.md
PR 6186 docs/dev/ENVIRONMENT.md
PR 6924 docs/dev/ENVIRONMENT.md
PR 7275 docs/dev/ENVIRONMENT.md
PR 7642 docs/dev/ENVIRONMENT.md
PR 7643 docs/dev/ENVIRONMENT.md
PR 7715 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 8246 docs/dev/ENVIRONMENT.md
PR 8965 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 9087 docs/dev/debt/libc.md
PR 9289 docs/dev/ENVIRONMENT.md
PR 9345 docs/dev/ENVIRONMENT.md
PR 9356 docs/dev/ENVIRONMENT.md
PR 9387 docs/dev/ENVIRONMENT.md
PR 9508 docs/dev/ENVIRONMENT.md
PR 9584 core/libs/prx/libc/CMakeLists.txt
PR 9712 docs/dev/ENVIRONMENT.md
PR 9852 docs/dev/ENVIRONMENT.md
PR 10007 docs/dev/debt/libc.md
PR 10113 core/libs/prx/libc/CMakeLists.txt
PR 10193 docs/dev/ENVIRONMENT.md
PR 10226 core/libs/prx/libc/CMakeLists.txt
PR 10409 docs/dev/debt/libc.md
PR 11435 docs/dev/ENVIRONMENT.md
PR 11661 docs/dev/debt/libc.md
PR 11689 docs/dev/debt/libc.md
PR 11698 docs/dev/debt/libc.md
PR 12184 docs/dev/debt/libc.md
PR 12324 docs/dev/ENVIRONMENT.md
PR 12544 docs/dev/ENVIRONMENT.md
PR 12682 core/libs/prx/libc/CMakeLists.txt
PR 12688 core/libs/prx/libc/CMakeLists.txt
PR 12700 core/libs/prx/libc/CMakeLists.txt
PR 12717 core/libs/prx/libc/CMakeLists.txt
PR 12746 docs/dev/ENVIRONMENT.md
PR 12863 docs/dev/ENVIRONMENT.md
PR 12965 core/libs/prx/libc/CMakeLists.txt
PR 13809 docs/dev/ENVIRONMENT.md
PR 13863 docs/dev/ENVIRONMENT.md
PR 13920 docs/dev/ENVIRONMENT.md
PR 13928 docs/dev/ENVIRONMENT.md
PR 13929 docs/dev/ENVIRONMENT.md
PR 14260 docs/dev/ENVIRONMENT.md
PR 14262 docs/dev/ENVIRONMENT.md
PR 15456 docs/dev/ENVIRONMENT.md
PR 15529 docs/dev/ENVIRONMENT.md
PR 15548 docs/dev/ENVIRONMENT.md
PR 15570 docs/dev/ENVIRONMENT.md
PR 15973 docs/dev/debt/libc.md
PR 16214 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 16217 docs/dev/ENVIRONMENT.md
PR 16354 docs/dev/ENVIRONMENT.md
PR 16371 docs/dev/ENVIRONMENT.md
PR 16372 docs/dev/ENVIRONMENT.md
PR 16427 docs/dev/ENVIRONMENT.md
PR 16516 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 16560 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 16793 docs/dev/ENVIRONMENT.md
PR 16831 docs/dev/ENVIRONMENT.md
PR 16919 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 16924 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 16944 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 16949 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 16953 docs/dev/ENVIRONMENT.md
PR 16975 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 17259 docs/dev/ENVIRONMENT.md
docs/dev/debt/libc.md
PR 17261 core/libs/prx/libc/CMakeLists.txt
docs/dev/ENVIRONMENT.md
docs/dev/debt/libc.md
PR 17277 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 17296 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 17331 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 17539 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 17555 core/libs/prx/libc/CMakeLists.txt
docs/dev/ENVIRONMENT.md
docs/dev/debt/libc.md
PR 17556 core/libs/prx/libc/CMakeLists.txt
docs/dev/ENVIRONMENT.md
docs/dev/debt/libc.md
PR 17557 core/libs/prx/libc/CMakeLists.txt
docs/dev/ENVIRONMENT.md
docs/dev/debt/libc.md
PR 17558 core/libs/prx/libc/CMakeLists.txt
docs/dev/ENVIRONMENT.md
docs/dev/debt/libc.md
PR 17568 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 17578 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 17607 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 17610 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 17611 docs/dev/ENVIRONMENT.md
PR 17719 docs/dev/ENVIRONMENT.md
PR 17729 docs/dev/ENVIRONMENT.md
PR 17943 docs/dev/ENVIRONMENT.md
PR 18029 docs/dev/ENVIRONMENT.md
PR 18082 docs/dev/ENVIRONMENT.md
PR 18173 docs/dev/ENVIRONMENT.md
PR 18226 docs/dev/ENVIRONMENT.md
PR 18293 docs/dev/ENVIRONMENT.md
PR 18693 core/libs/prx/libc/CMakeLists.txt
docs/dev/ENVIRONMENT.md
PR 18829 docs/dev/ENVIRONMENT.md
PR 19181 core/libs/prx/libc/CMakeLists.txt
PR 20041 docs/dev/ENVIRONMENT.md
PR 20172 docs/dev/ENVIRONMENT.md
PR 20248 docs/dev/ENVIRONMENT.md
PR 20518 docs/dev/ENVIRONMENT.md
PR 20519 docs/dev/ENVIRONMENT.md
PR 21211 docs/dev/ENVIRONMENT.md
PR 21236 core/libs/prx/libc/CMakeLists.txt
PR 21303 docs/dev/ENVIRONMENT.md
PR 21460 docs/dev/ENVIRONMENT.md
PR 21649 docs/dev/ENVIRONMENT.md
PR 22025 docs/dev/ENVIRONMENT.md
PR 22071 docs/dev/ENVIRONMENT.md
PR 22190 docs/dev/ENVIRONMENT.md
PR 22424 docs/dev/ENVIRONMENT.md
PR 22434 docs/dev/ENVIRONMENT.md
PR 22546 docs/dev/ENVIRONMENT.md
PR 22647 docs/dev/ENVIRONMENT.md
PR 22692 docs/dev/ENVIRONMENT.md
PR 22697 docs/dev/ENVIRONMENT.md
PR 22944 docs/dev/ENVIRONMENT.md
PR 23242 docs/dev/ENVIRONMENT.md
PR 23244 docs/dev/ENVIRONMENT.md
PR 23395 core/libs/prx/libc/CMakeLists.txt
PR 23596 docs/dev/ENVIRONMENT.md
PR 23739 docs/dev/ENVIRONMENT.md
PR 23811 docs/dev/ENVIRONMENT.md
PR 23975 docs/dev/ENVIRONMENT.md
PR 24176 docs/dev/ENVIRONMENT.md
PR 24217 core/libs/prx/libc/CMakeLists.txt
PR 24327 docs/dev/ENVIRONMENT.md
PR 24377 docs/dev/debt/libc.md
PR 24445 docs/dev/ENVIRONMENT.md
PR 24510 docs/dev/ENVIRONMENT.md
PR 24523 docs/dev/ENVIRONMENT.md
PR 24661 docs/dev/ENVIRONMENT.md
PR 24714 docs/dev/ENVIRONMENT.md
PR 24756 docs/dev/ENVIRONMENT.md
PR 24936 docs/dev/ENVIRONMENT.md
PR 25289 core/libs/prx/libc/CMakeLists.txt
PR 25534 docs/dev/ENVIRONMENT.md
PR 25674 core/libs/prx/libc/CMakeLists.txt
PR 25703 docs/dev/ENVIRONMENT.md
PR 25708 core/libs/prx/libc/CMakeLists.txt
PR 25744 core/libs/prx/libc/CMakeLists.txt
PR 25750 core/libs/prx/libc/CMakeLists.txt
PR 25759 core/libs/prx/libc/CMakeLists.txt
PR 25763 core/libs/prx/libc/CMakeLists.txt
PR 26365 docs/dev/ENVIRONMENT.md
PR 26613 docs/dev/ENVIRONMENT.md
PR 26686 docs/dev/ENVIRONMENT.md
PR 26796 core/libs/prx/libc/CMakeLists.txt
PR 26913 docs/dev/ENVIRONMENT.md
PR 27133 docs/dev/ENVIRONMENT.md
PR 27164 core/libs/prx/libc/CMakeLists.txt
docs/dev/ENVIRONMENT.md
PR 27288 docs/dev/ENVIRONMENT.md
PR 27471 docs/dev/ENVIRONMENT.md
PR 27540 core/libs/prx/libc/CMakeLists.txt
PR 27566 core/libs/prx/libc/CMakeLists.txt
PR 27568 core/libs/prx/libc/CMakeLists.txt
PR 27569 core/libs/prx/libc/CMakeLists.txt
PR 27578 core/libs/prx/libc/CMakeLists.txt
PR 27581 core/libs/prx/libc/CMakeLists.txt
PR 27646 core/libs/prx/libc/CMakeLists.txt
PR 27688 docs/dev/ENVIRONMENT.md
PR 27811 docs/dev/ENVIRONMENT.md
PR 27815 core/libs/prx/libc/CMakeLists.txt
PR 27823 core/libs/prx/libc/CMakeLists.txt
PR 27864 docs/dev/ENVIRONMENT.md
PR 27872 docs/dev/ENVIRONMENT.md
PR 27984 docs/dev/ENVIRONMENT.md
PR 28043 docs/dev/ENVIRONMENT.md
PR 28051 core/libs/prx/libc/CMakeLists.txt
docs/dev/ENVIRONMENT.md
PR 28059 docs/dev/ENVIRONMENT.md
PR 28071 core/libs/prx/libc/CMakeLists.txt
PR 28077 docs/dev/ENVIRONMENT.md
PR 28102 docs/dev/ENVIRONMENT.md
PR 28140 docs/dev/ENVIRONMENT.md
PR 28142 docs/dev/ENVIRONMENT.md
PR 28150 docs/dev/ENVIRONMENT.md
PR 28240 docs/dev/ENVIRONMENT.md
PR 28252 docs/dev/ENVIRONMENT.md
PR 28289 docs/dev/ENVIRONMENT.md
PR 28295 docs/dev/ENVIRONMENT.md
PR 28296 docs/dev/ENVIRONMENT.md
PR 28299 docs/dev/ENVIRONMENT.md
PR 28332 docs/dev/ENVIRONMENT.md
PR 28372 docs/dev/ENVIRONMENT.md
PR 28384 docs/dev/ENVIRONMENT.md
PR 28387 docs/dev/ENVIRONMENT.md
PR 28390 docs/dev/ENVIRONMENT.md
PR 28391 docs/dev/ENVIRONMENT.md
PR 28394 core/libs/prx/libc/CMakeLists.txt
PR 28411 docs/dev/ENVIRONMENT.md
PR 28434 docs/dev/ENVIRONMENT.md
PR 28470 docs/dev/ENVIRONMENT.md
PR 28476 docs/dev/ENVIRONMENT.md
PR 28487 docs/dev/ENVIRONMENT.md
PR 28488 docs/dev/ENVIRONMENT.md
PR 28490 docs/dev/ENVIRONMENT.md
PR 28590 docs/dev/ENVIRONMENT.md
PR 28622 docs/dev/ENVIRONMENT.md
PR 28624 docs/dev/ENVIRONMENT.md
PR 28631 docs/dev/ENVIRONMENT.md
PR 28655 core/libs/prx/libc/CMakeLists.txt
PR 28673 docs/dev/ENVIRONMENT.md
PR 28702 docs/dev/ENVIRONMENT.md
PR 28704 docs/dev/ENVIRONMENT.md
PR 28709 core/libs/prx/libc/CMakeLists.txt
PR 28710 core/libs/prx/libc/CMakeLists.txt
PR 28738 docs/dev/ENVIRONMENT.md
PR 28742 core/libs/prx/libc/CMakeLists.txt
PR 28758 core/libs/prx/libc/CMakeLists.txt
PR 28765 docs/dev/ENVIRONMENT.md
PR 28766 docs/dev/ENVIRONMENT.md
PR 28768 docs/dev/ENVIRONMENT.md
PR 28786 docs/dev/ENVIRONMENT.md
PR 28787 docs/dev/ENVIRONMENT.md
PR 28805 docs/dev/ENVIRONMENT.md
PR 28808 core/libs/prx/libc/CMakeLists.txt
docs/dev/ENVIRONMENT.md
PR 28814 docs/dev/ENVIRONMENT.md
PR 28839 core/libs/prx/libc/CMakeLists.txt
PR 28845 docs/dev/ENVIRONMENT.md
PR 28893 docs/dev/ENVIRONMENT.md
PR 28914 docs/dev/ENVIRONMENT.md
PR 28921 docs/dev/ENVIRONMENT.md
PR 28925 docs/dev/ENVIRONMENT.md
PR 28934 docs/dev/ENVIRONMENT.md
PR 28936 docs/dev/ENVIRONMENT.md
PR 28941 docs/dev/ENVIRONMENT.md
PR 28943 docs/dev/ENVIRONMENT.md
PR 28948 docs/dev/ENVIRONMENT.md
PR 28953 docs/dev/ENVIRONMENT.md
PR 28955 docs/dev/ENVIRONMENT.md
PR 28958 docs/dev/ENVIRONMENT.md
PR 28960 docs/dev/ENVIRONMENT.md
PR 28962 docs/dev/ENVIRONMENT.md
PR 28964 docs/dev/ENVIRONMENT.md
PR 28971 docs/dev/ENVIRONMENT.md
PR 28980 docs/dev/ENVIRONMENT.md
PR 28983 docs/dev/ENVIRONMENT.md
PR 28985 docs/dev/ENVIRONMENT.md
PR 28986 docs/dev/ENVIRONMENT.md
PR 28995 docs/dev/ENVIRONMENT.md
PR 28999 docs/dev/ENVIRONMENT.md
PR 29000 docs/dev/ENVIRONMENT.md
PR 29032 docs/dev/ENVIRONMENT.md
PR 29033 docs/dev/ENVIRONMENT.md
PR 29037 docs/dev/ENVIRONMENT.md
PR 29038 docs/dev/ENVIRONMENT.md
PR 29042 docs/dev/ENVIRONMENT.md
PR 29052 docs/dev/ENVIRONMENT.md
PR 29053 docs/dev/ENVIRONMENT.md
PR 29059 docs/dev/ENVIRONMENT.md
PR 29066 docs/dev/ENVIRONMENT.md
PR 29067 docs/dev/ENVIRONMENT.md
PR 29069 docs/dev/ENVIRONMENT.md
PR 29070 docs/dev/ENVIRONMENT.md
PR 29072 docs/dev/ENVIRONMENT.md
PR 29073 docs/dev/ENVIRONMENT.md
PR 29074 docs/dev/ENVIRONMENT.md
PR 29076 docs/dev/ENVIRONMENT.md
PR 29084 docs/dev/ENVIRONMENT.md
PR 29085 docs/dev/ENVIRONMENT.md
PR 29086 docs/dev/ENVIRONMENT.md
PR 29087 docs/dev/ENVIRONMENT.md
PR 29089 docs/dev/ENVIRONMENT.md
PR 29090 docs/dev/ENVIRONMENT.md
PR 29091 docs/dev/ENVIRONMENT.md
PR 29093 docs/dev/ENVIRONMENT.md
PR 29094 docs/dev/ENVIRONMENT.md
PR 29095 docs/dev/ENVIRONMENT.md
PR 29096 docs/dev/ENVIRONMENT.md
PR 29097 docs/dev/ENVIRONMENT.md
PR 29098 docs/dev/ENVIRONMENT.md
PR 29099 core/libs/prx/libc/CMakeLists.txt
PR 29100 core/libs/prx/libc/CMakeLists.txt
PR 29101 docs/dev/ENVIRONMENT.md
PR 29102 docs/dev/ENVIRONMENT.md
PR 29103 docs/dev/ENVIRONMENT.md
PR 29104 docs/dev/ENVIRONMENT.md
PR 29105 docs/dev/ENVIRONMENT.md
PR 29106 docs/dev/ENVIRONMENT.md
PR 29107 docs/dev/ENVIRONMENT.md
PR 29108 docs/dev/ENVIRONMENT.md
PR 29110 docs/dev/ENVIRONMENT.md
PR 29111 core/libs/prx/libc/CMakeLists.txt
PR 29113 docs/dev/ENVIRONMENT.md
PR 29115 docs/dev/ENVIRONMENT.md
PR 29116 docs/dev/ENVIRONMENT.md
PR 29117 docs/dev/ENVIRONMENT.md
PR 29118 docs/dev/ENVIRONMENT.md
PR 29119 docs/dev/ENVIRONMENT.md
PR 29120 docs/dev/ENVIRONMENT.md
PR 29121 docs/dev/ENVIRONMENT.md
PR 29123 docs/dev/ENVIRONMENT.md
PR 29211 docs/dev/ENVIRONMENT.md
PR 29253 core/libs/prx/libc/CMakeLists.txt
PR 29256 docs/dev/ENVIRONMENT.md
PR 29268 core/libs/prx/libc/CMakeLists.txt
PR 29269 core/libs/prx/libc/CMakeLists.txt
PR 29270 core/libs/prx/libc/CMakeLists.txt
PR 29271 core/libs/prx/libc/CMakeLists.txt
PR 29272 core/libs/prx/libc/CMakeLists.txt
PR 29273 core/libs/prx/libc/CMakeLists.txt
PR 29293 docs/dev/ENVIRONMENT.md

@imellag

imellag commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

macOS validation, since the description lists it as outstanding. Apple M4 Pro, macOS 27.2, Apple clang 21.0.0, x86-64 Release under Rosetta 2. main doesn't build its libraries on macOS on its own, so both sides use our support branch support/macos-boot-1030c (05bd71a66b, main 21a556f567 + the open macOS PRs; none touches GuestHeap.cpp). The change side is that branch with head 556a92d0ee merged (clean merge, only this PR's 5 files). Full build passes on both.

ctest -R 'heap|malloc|alloc' -j4:

  • Base: 46 of 47 pass. guest_heap_lifetime fails with guest heap during exit: mutex lock failed: Invalid argument. The ArenaHeap function-local static is built at the test's first allocation, after its atexit handler is registered, so it is destroyed before the handler runs. On macOS, locking the destroyed std::mutex fails with EINVAL; glibc doesn't report it, which is likely why this only shows on macOS.
  • This PR: 69 of 69 pass (the same 47 plus the 22 new guest_heap_small_spans* registrations). guest_heap_lifetime passes 3 of 3 run directly, since ArenaHeap::Get() now has process lifetime.

So the process-lifetime change also fixes guest_heap_lifetime on macOS. Frame-time effects weren't measured here.

AI-assisted: yes

@CnRJay CnRJay left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correction (2026-11-01): the title-ID/log demand below is not a CONTRIBUTING requirement; Unblocks: none is allowed. The technical points below are unaffected.

  1. No title reaches this. Unblocks: none, and the body says outright that the measurements "measure native allocator workloads, not a title". Please name a title that exhausts commitment on main with a log line that shows it, otherwise there is nothing to show the flag is needed.
  2. The dense run is slower. The only timing row is 416 ms against 432 ms (+3.8%) for dense workloads, and the body says it "does not establish title frame-time behavior". A reclaiming allocator that adds per-span occupancy and free-list tracking is a cost on every small allocation and free; tools/trace_digest.py summaries of main and the flag on, same machine and scene, would show it. The 300 MiB to 150.5 MiB result is for a synthetic two-phase fixture.
  3. Safety rests on a different PR. "Enable only with #11468": without it a double free decrements span occupancy twice and can release a span holding live objects, i.e. silent corruption of guest memory. A flag whose safe use depends on an unmerged PR should not merge ahead of it. The presence-flag semantics make it worse: APS5_RECLAIM_SMALL_HEAP=0 enables it.
  4. A change to the default path. ArenaHeap::Get() now has process lifetime "even when the flag is unset", so its metadata and large-block-cache containers are no longer destroyed at exit. That is a behaviour change outside the flag; is it needed for the opt-in path, and what was the leak-check result?
  5. Reclamation resets the mapping and calls GuestArenaReset, which drops and re-faults pages. After a free, a title that allocates the same class a moment later pays a page-fault storm; the retained warm span (one per class) bounds it only for one span. Please include a churn test (alloc/free a 1 MiB working set repeatedly) with timing.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — comments

Changes are required before merge: resolve the rollback and release failure paths so failed cleanup cannot leave span metadata inconsistent.

What I ran

Reviewed head aad9fecb1312d8a2235465c8466e8c07b41f274c and its prepared diff. No commands or tests were run.

Files read: core/libs/prx/libc/CMakeLists.txt, core/libs/prx/libc/src/GuestHeap.cpp, core/libs/tests/GuestHeapSmallSpans.cpp, docs/dev/ENVIRONMENT.md, and docs/dev/debt/libc.md. Also read core/libs/prx/libc/src/GuestArena.cpp and core/libs/prx/libc/src/GuestAllocations.cpp for context. All five changed files were included in the manifest; files.json was unavailable.

Results

Check Result Note
Diff and changed files passed Five changed files inspected
Tests not run Author-reported test results not independently verified
Runtime/platform behavior not run No local build or console run

Findings

Blocking

  • core/libs/prx/libc/src/GuestHeap.cpp:205: if resetting a failed growth range succeeds but invalidation throws, rollbackSmall quarantines the span without decrementing span.committed or heap system accounting. A later free of its last live allocation can then run freeSmall's empty-span path and retain the quarantined span as sizeClass.empty; subsequent allocations can reuse its span metadata despite quarantined because allocateSmall does not filter it. This contradicts the stated guarantee that a cleanup failure quarantines the span. Keep quarantined spans out of both allocation and empty-span retention, and make successful reset accounting reflect committed bytes removed.

  • core/libs/prx/libc/src/GuestHeap.cpp:261: on the second empty span, the code unlinks it before reset/invalidation/release, but exceptions from those calls do not mark it quarantined or restore a safe state. A reset or invalidation failure leaves a span with live count zero, still present in the map and no longer available; a release failure occurs after accounting was shrunk and may leave the reservation registered. Handle each cleanup failure consistently and ensure the span cannot be reallocated or retained as the warm empty span.

Non-blocking

None.

Not verified

No tests were run. The author reports Windows and Linux allocator test results and contributor macOS validation in the PR description; those results were not independently verified. Physical-console behavior and title performance remain unverified, as the description itself notes. The complete contents of the 1000-line PR description were not read; relevant goal, reported test results, limitations, and gameplay evidence were read. No changed file was excluded according to the manifest.

To get this to a good state

Fix both cleanup paths so a failed reset, invalidation, or release cannot leave a span reusable or accounting inconsistent. Then rerun the allocator test suite, including the quarantine and growth rollback cases, on the new head.

@ligmaSec ligmaSec left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Built the focused checks against the existing Linux runtime. GuestHeapSmallSpans passed in the default, reclaim, live, and reuse modes with the configuration used by the registered tests. A trial merge against integration main reports conflicts in GuestHeap.cpp and the environment guide.

AI-assisted: yes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build docs libc needs rebase Conflicts with main, rebase needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants