Skip to content

A string written through a reference element of an array property leaks. #354

Closed

Description

@blacktrs

Summary

A string written through a reference element of an array property leaks.

Repro

<?php
class T { public array $r = []; }
function one($i) { $t = new T; $y = "z$i"; $t->r[] = &$y; $t->r[0] = "q"; }
for ($i = 0; $i < 3000; $i++) one($i);
$b = memory_get_peak_usage();
for ($i = 0; $i < 60000; $i++) one($i);
echo memory_get_peak_usage() - $b < 1024 * 1024 ? "flat\n" : "grew\n";

Expected (php)

flat

Actual (manticore 868c12ed, Darwin arm64)

grew

Tracking

Known-bug repro: tests/aot/repro/leak/ref_element_string_write.php — bash tests/aot/xfail.sh -k ref_element_string_write 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 19, 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