PHP 4.0 Bug #9407: Memory Problem while using self referencing objects...
| From: | zimt@php.net | Date: | Thu, 22 Feb 2001 17:09:20 +0000 |
| Subject: | PHP 4.0 Bug #9407: Memory Problem while using self referencing objects... | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-47266@lists.php.net to get a copy of this message | ||
From: zimt@php.net
Operating system: Linux (Red Hat 6.1german) on Kernel 2.2.12-32
PHP version: 4.0.4pl1
PHP Bug Type: Performance problem
Bug description: Memory Problem while using self referencing objects...
-----configure-----
"./configure" \
"--with-apache=../apache_1.3.14" \
"--with-mysql" \
"--enable-sysvshm" \
"--enable-sysvsem" \
"--with-gd" \
"--enable-trans-sid" \
"--with-config-file-path=/etc/" \
"--enable-url-includes" \
"--enable-magic-quotes" \
"--enable-track-vars" \
"--enable-sockets" \
"--with-jpeg-dir=/root/jpeg-6b/" \
"--with-imap=/root/imap-2000b" \
-----configure-----
maybe i should mention, that
this problem happend with every other configuration i tested (other Servers) too
-----sample-scripts-----
-----class-one-----
<?php
/**
* Class one
*/
class one
{
/**
* @var object foobar contains reference to this object
*/
var $foobar1;
/**
* @var object foobar2 contains reference to another object
*/
var $foobar2;
/**
* Constructor, putting reference of array including this object in class var $foobar
* @param object foobar reference to array including this object
*/
function one(&$foobar)
{
$this->foobar1 =& $foobar[0];
$this->foobar2 =& $foobar[1];
}
}
?>
-----class-one-----
-----class-two-----
<?php
/**
* Class one
*/
class two extends some_other_class_but_not_class_one
{
/**
* @var string foo defaults to "bar"
*/
var $foo ="bar";
/**
* Calling constructor of parent class.. nothing from intrest,
* tested this using diffrent classes, this example is just
* meant for those who say "Why dont you just extend class
* one/two to let them work together
*/
function two()
{
$this->some_other_class_but_not_class_one();
}
}
?>
-----class-two-----
-----script------
<?php
include("class.one.php");
include("class.two.php");
/* needed for some reasons, i dont think here is the problem */
session_start();
session_register($classarray);
$classarray[0] = new one($classarray);
$classarray[1] = new two;
?>
-----script------
-----sample-scripts-----
-----problem-----
Execute a set of scripts like this, uhm say 3000 times, youll notice that
your free mem will get lower and lower...
i noticed that when my mem was full... not really cool...
i think this is a problem of the garbage collection, but im not sure...
any ideas?
Peter Petermann
--
Edit Bug report at: http://bugs.php.net/?id=9407&edit=1