Bug #77209 [Com]: Leaks memory
| From: | silicid at gmailc dot om | Date: | Tue, 27 Nov 2018 13:20:12 +0000 |
| Subject: | Bug #77209 [Com]: Leaks memory | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-218162@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77209&edit=1
ID: 77209
Comment by: silicid at gmailc dot om
Reported by: silicid at gmail dot com
Summary: Leaks memory
Status: Open
Type: Bug
Package: Performance problem
Operating System: Debian 8
PHP Version: 7.2.12
Block user comment: N
Private report: N
New Comment:
PHP Version 7.2.12-1+0~20181112102353.11+jessie~1.gbp55f215
System Linux VV10015-z2174 4.15.17-3-pve #1 SMP PVE 4.15.17-13 (Mon, 18 Jun 2018 17:15:04 +0200)
x86_64
Build Date Nov 12 2018 13:46:27
Previous Comments:
------------------------------------------------------------------------
[2018-11-27 12:09:57] silicid at gmail dot com
Description:
------------
You must create a file with the specified code.
If you execute method "is_object" from "$this" and unset the object, then leaks
memory. But if you call method "is_object" for "$object", then there are no
problems.
In version 7.1 there are no problems. There are no problems in Windows.
Test script:
---------------
<?php
class Test {
public function __construct() {
for ($i = 0; $i < 1000; ++$i) {
$this->result[] = rand(1, 1000);
}
}
function object() {
is_object($this);
}
}
$memory = memory_get_usage();
for ($i = 0; $i < 1; ++$i) {
$object = new Test();
$object->object();
unset($object);
}
var_dump(memory_get_usage() - $memory);
$memory = memory_get_usage();
for ($i = 0; $i < 100; ++$i) {
$object = new Test();
$object->object();
unset($object);
}
var_dump(memory_get_usage() - $memory);
$memory = memory_get_usage();
for ($i = 0; $i < 100; ++$i) {
$object = new Test();
is_object($object);
unset($object);
}
var_dump(memory_get_usage() - $memory);
Expected result:
----------------
int(0)
int(0)
int(0)
Actual result:
--------------
int(37336)
int(3733600)
int(0)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77209&edit=1