#23548 [Fbk]: Memory leak
| From: | moriyoshi@php.net | Date: | Thu, 08 May 2003 16:59:22 +0000 |
| Subject: | #23548 [Fbk]: Memory leak | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-39322@lists.php.net to get a copy of this message | ||
ID: 23548
Updated by: moriyoshi@php.net
Reported By: neon at neon-line dot net
Status: Feedback
Bug Type: Scripting Engine problem
Operating System: Debian Linux
PHP Version: 4.3.2RC2
New Comment:
It looks like your script uses objects to represent some tree-like
structure and those objects have circular references. That is,
<?php
class foo {
var $childs;
var $parent;
function foo() {
$this->childs = array();
$this->parent = NULL;
}
function appendChild(&$child) {
$this->childs[] = &$child;
$child->setParent($this);
}
function setParent(&$parent) {
$this->parent = &$parent;
}
}
$a = &new foo();
$b = &new foo();
$a->appendChild($b);
?>
This causes awful leaks, but it's inevitable due to the language
design; PHP employs reference-count based garbage collection.
Previous Comments:
------------------------------------------------------------------------
[2003-05-08 11:37:14] neon at neon-line dot net
Feel free to mark this back to Feedback status. Leak hapends after data
has been sent and script is about to exit. I'm unable to reproduct the
problem with a short script.
------------------------------------------------------------------------
[2003-05-08 11:18:19] neon at neon-line dot net
I have been unable to create a short reproducing
script so far. Still working on it, but I have very litle information
what might cause this memory leak. Still trying to figure that out.
------------------------------------------------------------------------
[2003-05-08 10:04:18] edink@php.net
It is very difficult to determine anything without a short reproducing
script. Could you try doing that?
------------------------------------------------------------------------
[2003-05-08 09:58:12] neon at neon-line dot net
I'm still unable to create/locate code which causes this leak, but I'll
give it as soon as I locate it. Because there is no use to paste tons
of code. Bug was found while testing phpSysInfo script (propably in
XPath.class).
/root/php4-STABLE-200304251730/Zend/zend_execute.c(489) : Freeing
0x087D418C (12 bytes), script=/www/system/index.php
Last leak repeated 129 times
/root/php4-STABLE-200304251730/Zend/zend_execute.c(1214) : Freeing
0x087D414C (12 bytes), script=/www/system/index.php
Last leak repeated 50 times
/root/php4-STABLE-200304251730/Zend/zend_execute.c(478) : Freeing
0x087D410C (12 bytes), script=/www/system/index.php
Last leak repeated 52 times
/root/php4-STABLE-200304251730/Zend/zend_operators.c(1056) : Freeing
0x087D4004 (32 bytes), script=/www/system/index.php
Last leak repeated 101 times
/root/php4-STABLE-200304251730/Zend/zend_hash.c(406) : Freeing
0x087CE264 (35 bytes), script=/www/system/index.php
Last leak repeated 174 times
/root/php4-STABLE-200304251730/Zend/zend_execute.c(278) : Freeing
0x087CE224 (12 bytes), script=/www/system/index.php
Last leak repeated 116 times
/root/php4-STABLE-200304251730/Zend/zend_operators.c(1049) : Freeing
0x087CE084 (4 bytes), script=/www/system/index.php
Last leak repeated 70 times
/root/php4-STABLE-200304251730/Zend/zend_hash.c(178) : Freeing
0x087CDEEC (32 bytes), script=/www/system/index.php
Last leak repeated 74 times
/root/php4-STABLE-200304251730/Zend/zend_execute.c(764) : Freeing
0x087CDA84 (12 bytes), script=/www/system/index.php
Last leak repeated 261 times
/root/php4-STABLE-200304251730/Zend/zend_hash.c(440) : Freeing
0x087CDE24 (64 bytes), script=/www/system/index.php
Last leak repeated 58 times
/root/php4-STABLE-200304251730/Zend/zend_hash.c(262) : Freeing
0x087CDDC4 (41 bytes), script=/www/system/index.php
Last leak repeated 532 times
/root/php4-STABLE-200304251730/ext/xml/xml.c(262) : Freeing 0x087CD7EC
(8 bytes), script=/www/system/index.php
Last leak repeated 57 times
/root/php4-STABLE-200304251730/ext/xml/xml.c(258) : Freeing 0x08690754
(12 bytes), script=/www/system/index.php
Last leak repeated 57 times
/root/php4-STABLE-200304251730/Zend/zend_API.c(678) : Freeing
0x0869113C (12 bytes), script=/www/system/index.php
Last leak repeated 1 time
/root/php4-STABLE-200304251730/ext/xml/xml.c(512) : Freeing 0x086910FC
(11 bytes), script=/www/system/index.php
Last leak repeated 1 time
/root/php4-STABLE-200304251730/ext/xml/xml.c(648) : Freeing 0x0868F504
(44 bytes), script=/www/system/index.php
/root/php4-STABLE-200304251730/Zend/zend_API.c(562) : Actual location
(location was relayed)
/root/php4-STABLE-200304251730/Zend/zend_execute_API.c(341) : Freeing
0x087B1ECC (44 bytes), script=/www/system/index.php
/root/php4-STABLE-200304251730/Zend/zend_variables.c(122) : Actual
location (location was relayed)
Last leak repeated 3 times
/root/php4-STABLE-200304251730/ext/xml/xml.c(647) : Freeing 0x0877A21C
(12 bytes), script=/www/system/index.php
Zend/zend_language_scanner.c(4675) : Freeing 0x086C1EEC (1 bytes),
script=/www/system/index.php
/root/php4-STABLE-200304251730/Zend/zend_compile.c(1866) : Freeing
0x086C1E4C (12 bytes), script=/www/system/index.php
Last leak repeated 3 times
Sorry that I can't give detailed description.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=23548&edit=1