Bug #65340 [Opn->Csd]: Memory leak when using magic __set ?
Edit report at https://bugs.php.net/bug.php?id=65340&edit=1
ID: 65340
Updated by: nikic@php.net
Reported by: vitalif at mail dot ru
Summary: Memory leak when using magic __set ?
-Status: Open
+Status: Closed
Type: Bug
Package: Class/Object related
Operating System: Linux
PHP Version: 5.5.1
-Assigned To:
+Assigned To: nikic
Block user comment: N
Private report: N
New Comment:
This issue has been fixed in PHP 7.1. Memory usage should now be constant for typical uses (no
recursion over different property names) of magic getters/setters.
Previous Comments:
------------------------------------------------------------------------
[2015-08-28 21:30:14] vitalif at mail dot ru
But of course it's still a bug? :)
------------------------------------------------------------------------
[2015-08-28 21:21:18] nikic@php.net
The reason for this are property recursion guards. In PHP 5 32bit these take 72 bytes per distinct
property name that was used with __get/etc. so in this case it would be 72*500000 bytes, which
matches your numbers.
------------------------------------------------------------------------
[2015-03-19 12:12:27] php at bof dot de
Just tested with 5.6.7, issue is reproducible.
------------------------------------------------------------------------
[2013-10-05 22:04:07] vitalif at mail dot ru
Anyone? I've rechecked it on 5.5.4 - the bug is still there.
------------------------------------------------------------------------
[2013-07-27 21:32:43] vitalif at mail dot ru
I don't think bug #48197 is related to this issue... There are no memory leaks. I.e. extra
alloc done by __call in that bug is freed without problem (if you remove "$b[$i] =" and
just throw away the value after each call).
And here I describe that an identical object takes twice more memory if you write in its array
property using __set.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=65340
--
Edit this bug report at https://bugs.php.net/bug.php?id=65340&edit=1
Thread (10 messages)