Repository navigation
php-in-php: VmMemory RSS path — remove host getrusage() fallback for bootstrap self-host (#4862, #3280) #7287
Copy link
Copy link
Labels
area:compilerCompiler / CFG / JITCompiler / CFG / JITarea:vmVirtual machineVirtual machineenhancementNew feature or requestNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimSpec complete: repro, php-src ref, done-when — safe for workers to claimphase-0:FoundationPhase 0 – foundation & DevExPhase 0 – foundation & DevExphase-4:stdlibPhase 4 – stdlib for web appsPhase 4 – stdlib for web apps
Description
Activity
- addedenhancementNew feature or requestNew feature or requestphase-0:FoundationPhase 0 – foundation & DevExPhase 0 – foundation & DevExphase-4:stdlibPhase 4 – stdlib for web appsPhase 4 – stdlib for web appsarea:compilerCompiler / CFG / JITCompiler / CFG / JITarea:vmVirtual machineVirtual machineimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimSpec complete: repro, php-src ref, done-when — safe for workers to claim
on Jun 7, 2026 claim: PHP Runtime → PHP — starting this run (#7287: remove host getrusage() fallback from VmMemory, align VM with MemoryRuntime /proc path).
claim: PHP Runtime → PHP — resuming #7287 (remove VmMemory getrusage fallback).
- added a commit that references this issue
on Jun 7, 2026 Merged via PR #7288.
Change:
VmMemory::readRssBytes()now reads RSS exclusively from/proc/self/statm— removed hostgetrusage()fallback so bootstrap/AOT binaries do not delegate to Zend PHP formemory_get_usage(true).Verification (Docker):
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh vendor/bin/phpunit test/unit/VmMemoryTest.php php bin/vm.php test/repro-maintainer/memory_native.php php bin/vm.php -r "echo memory_get_usage(true), PHP_EOL;" '
- VmMemoryTest: OK (2/2)
- memory_native repro: grow / peak / real
memory_get_usage(true)> 0 on Linux harness
- added a commit that references this issue
on Jun 10, 2026
Metadata
Metadata
Assignees
Labels
area:compilerCompiler / CFG / JITCompiler / CFG / JITarea:vmVirtual machineVirtual machineenhancementNew feature or requestNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimSpec complete: repro, php-src ref, done-when — safe for workers to claimphase-0:FoundationPhase 0 – foundation & DevExPhase 0 – foundation & DevExphase-4:stdlibPhase 4 – stdlib for web appsPhase 4 – stdlib for web apps
Category
php-in-php|bootstrapProblem
ext/standard/VmMemory.php::readRssBytes()falls back to hostgetrusage()when/proc/self/statmis unreadable:On the self-host path (native AOT binary, no Zend PHP), this either calls a host builtin during bootstrap or returns
0silently — breaking parity formemory_get_usage(true)/memory_get_peak_usage(true)andgc_status()memory fields tracked in #3280.Bootstrap inventory flags any
function_exists('getrusage')delegation in compiler-owned paths.php-src reference
ext/standard/basic_functions.c—memory_get_usage,zend_memory_usageZend/zend_alloc.c— emalloc counters (PHP path preferred over RSS)Repro
Build AOT hello-world and verify
memory_get_usage(true) > 0without host PHP installed (#1492 M3 probe).Scope (this repo)
ext/standard/VmMemory.php/proc/self/statmprimary; optionalphpc_read_rssthin ABI if needed — delete host getrusage()ext/standard/JitMemory.php/lib/JIT/Builtin/MemoryRuntime.phpext/standard/memory_get_usage.phptest/compliance/cases/stdlib/memory_get_usage*.phptShrink C if adding ABI; prefer pure PHP
/procread already used in JIT path.Done when
getrusage()call fromVmMemoryor JIT memory helpersmemory_get_usage(true)returns non-zero RSS on Linux VM and AOT binary in Dockerphp script/bootstrap-inventory.php --checkshows no new host-delegation warning for VmMemoryRelated