On 6/28/19 3:37 PM, Benjamin Morel wrote:
>     That's not a "leak". You create new objects (in this case, classes),
>     they take memory.
> 
> 
> Why do they not "leak" memory without eval() then? Replace with `$object
> = new class {};` and memory usage stays flat.
> There has do be some kind of garbage collection for these anonymous classes.

AFAIR this does not create new classes, since it's the same code, and
same code means same class. But eval() has new code every time, thus new
class. Generally I don't think PHP has any operation that can destroy an
existing class. It won't be easy too since you don't know whether there
are any objects of this class around (unless you're in shutdown).

-- 
Stas Malyshev
smalys...@gmail.com

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to