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
- [PHP-DEV] Memory leak in eval()'d code Benjamin Morel
- Re: [PHP-DEV] Memory leak in eval()'d code Johannes Schlüter
- Re: [PHP-DEV] Memory leak in eval()'d code Benjamin Morel
- Re: [PHP-DEV] Memory leak in eval()'d code Johannes Schlüter
- Re: [PHP-DEV] Memory leak in eval()'d code Stanislav Malyshev
- Re: [PHP-DEV] Memory leak in eval()'d code Benjamin Morel
- Re: [PHP-DEV] Memory leak in eval()'d ... Stanislav Malyshev
- RE: [PHP-DEV] Memory leak in eval... CHU Zhaowei
- Re: [PHP-DEV] Memory leak in ... Nikita Popov
- Re: [PHP-DEV] Memory leak... Benjamin Morel
- Re: [PHP-DEV] Memory leak... Stanislav Malyshev
- RE: [PHP-DEV] Memory leak... CHU Zhaowei
- RE: [PHP-DEV] Memory leak... CHU Zhaowei
- Re: [PHP-DEV] Memory leak... Nikita Popov
- Re: [PHP-DEV] Memory leak... Benjamin Morel
- Re: [PHP-DEV] Memory leak... Nikita Popov
- Re: [PHP-DEV] Memory leak... David Walker