Skip to content

php-in-php: VmMemory RSS — remove host getrusage() fallback (#7287) - #7288

Merged
PurHur merged 1 commit into
masterfrom
agent/runtime-php-vmmemory-rss-7287
Jun 7, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/runtime-php-vmmemory-rss-7287

Conversation

@PurHur

@PurHur PurHur commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Remove function_exists('getrusage') / getrusage() fallback from ext/standard/VmMemory::readRssBytes()
  • VM RSS now uses /proc/self/statm only, matching lib/JIT/Builtin/MemoryRuntime.php JIT/AOT path
  • Add test/unit/VmMemoryTest.php guarding against host delegation regression

Closes #7287

php-src reference

  • ext/standard/basic_functions.c — memory_get_usage / zend_memory_usage
  • PHP implementation: ext/standard/VmMemory.php + lib/JIT/Builtin/MemoryRuntime.php

Verification

./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;"
'

Output:

OK (2 tests, 4 assertions)
grow
peak
real
58073088

C runtime

No C changes — aligns VM with existing PHP LLVM MemoryRuntime (phpc_memory.c already deleted in #5377).

Follow-up

Top remaining C shrink candidate: lib/JIT/Builtin/hash_crypto_jit_runtime.c (~800 lines, #7189).

Made with Cursor

VmMemory now reads RSS exclusively via /proc/self/statm, matching the
JIT/AOT MemoryRuntime lowering and avoiding host PHP delegation on the
bootstrap/self-host path.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 2c18402 into master Jun 7, 2026
@PurHur
PurHur deleted the agent/runtime-php-vmmemory-rss-7287 branch June 7, 2026 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

php-in-php: VmMemory RSS path — remove host getrusage() fallback for bootstrap self-host (#4862, #3280)

1 participant