[php-src] Issue #8078: `eval` is leaking memory

From: Date: Fri, 11 Feb 2022 12:36:07 +0000
Subject: [php-src] Issue #8078: `eval` is leaking memory
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-239665@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8078 Comment Author: bwoebi This is by design - for now at least. This is not specific to eval, but to _any_ non-top level op_array (i.e. all functions). Generally, code, once compiled - unless it is top level code - is persisted for the request. For example, this also leaks: ``` php -r 'for ($i = 0; $i < 5; ++$i) { var_dump(memory_get_usage()); include "a.php"; }' int(430072) int(430888) int(431256) int(431624) int(431992) ``` with a.php being: ``` <?php if (false) { class A { } } ``` But we do currently not have any mechanisms to track unresolved (or Closure) op_arrays by their parent op_array to free them on eval or inclusion returning.

« previous php.bugs (#239665) next »