Skip to content

A dynamic method call on a fresh temporary receiver ((new F)->$m()) never releases the object. #257

Closed

Description

@blacktrs

Summary

A dynamic method call on a fresh temporary receiver ((new F)->$m()) never releases the object.

Repro

<?php
class F { private array $t = []; function s(): void { $this->t = [['x' => 'y' . mt_rand()]]; } }
function churn(int $n): void { $m = 's'; for ($i = 0; $i < $n; $i++) { (new F)->$m(); } }
churn(2000);
$before = memory_get_peak_usage();
churn(200000);
echo memory_get_peak_usage() - $before < 2 << 20 ? "flat\n" : "grows\n";

Expected (php)

flat

Actual (manticore fd82c7dd, Darwin arm64)

grows

Tracking

Known-bug repro: tests/aot/repro/leak/dynamic_method_call_on_temp_receiver_leaks.php — bash tests/aot/xfail.sh -k dynamic_method_call_on_temp_receiver_leaks reports XFAIL while this is open and XPASS once it is fixed; then move the repro into tests/aot/cases/ and close this issue.

Activity

  1. added
    bug
    leak
    on Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugleak

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions