Bug #1351: memory leak found in two functions: eval and include
| From: | makayg at math dot u-szeged dot hu | Date: | Tue, 27 Apr 1999 07:23:09 +0000 |
| Subject: | Bug #1351: memory leak found in two functions: eval and include | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-5267@lists.php.net to get a copy of this message | ||
From: makayg@math.u-szeged.hu
Operating system: Linux
PHP version: 3.0.7
PHP Bug Type: Performance problem
Bug description: memory leak found in two functions: eval and include
This is the test.phtml script:
---------------------------------------------
<?PHP
for ($i=0;$i<5000;$i++)
{
echo "$i: ";
// Uncomment one of the following two lines
include("hello.phtml");
// eval("echo 'Hello<BR>\n';");
flush();
}
?>
---------------------------------------------
This is the hello.phtml script:
---------------------------------------------
Hello<BR>
---------------------------------------------
Uncomment one of the "include" or "eval" lines (the script behaves the same in
both cases), then run
php -f test.phtml
then you will get the following fatal error after about 4095 lines of output:
Unable to initialize a new token in cache
Checking the memory usage in the whole system, it turns out that this test script quickly fills up
about 30 Mb of memory, then stops with the above error. Version 3.0.5 had a similar problem,
although it filled up only about 5 Mb, and did not stop after about 4095 lines (I tried with with
100000 in the "for" cycle), but rather filled up all memory the computer had. If I run
this script through an Apache module, then in all cases it stops after about 4095 lines. The
settings of the php3.ini file seem to be irrelevant, even the memory_limit option. Anyway, I only
changed the default configuration in the max_execution_time option, and I included the mysql
extension. I downloaded the binary 3.0.5 version from the Debian site, and I compiled the 3.0.7
version with no option (I simply said "./configure").
Since "eval" and "include" behave very similarly, I assume, that the problem is
in a subfunction of these functions. There does not seem to be any reason, why these functions
should leave memory behind after their run.
I could get rid of "eval" from my program (almost), but I do need "include", I
use it to regenerate our WWW pages from templates.
Please, tell me, if you received this message, or if you have a solution or workaround.
Thank you very much for your attention.
Sincerely yours,
Geza Makay
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net