Skip to content

Echo-form var_export($x) inside ob_start()/ob_end_clean() leaks memory on every call. #129

Closed

Description

@blacktrs

Summary

Echo-form var_export($x) inside ob_start()/ob_end_clean() leaks memory on every call.

Repro

<?php
$m0 = memory_get_peak_usage();
for ($r = 0; $r < 2000; $r++) {
    for ($i = 0; $i < 1000; $i++) {
        ob_start();
        var_export("value $i");
        ob_end_clean();
    }
}
$mb = (memory_get_peak_usage() - $m0) >> 20;
fwrite(STDERR, "grew {$mb} MB\n");
echo $mb < 8 ? "flat\n" : "LEAK\n";

Expected (php)

flat

Actual (manticore 32f98675, Darwin arm64)

LEAK
(stderr: grew 490 MB)

Tracking

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