php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29975 memory leaks
Submitted: 2004-09-03 21:21 UTC Modified: 2005-05-14 01:17 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: guth at fiifo dot u-psud dot fr Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2005-04-28 OS: *
Private report: No CVE-ID:
 [2004-09-03 21:21 UTC] guth at fiifo dot u-psud dot fr
Description:
------------
(i'm french, excuse me for my english)

I try to develop a CMS and i take more time to debug PHP than code PHP...
After 3 segmentation fault, I compiled PHP with --enable-debug, and my tests give the following errors.

Reproduce code:
---------------
/usr/src/php-5.0.1/Zend/zend_builtin_functions.c(1023) :  Freeing 0x0846F864 (23 bytes), script=/www/haricow/0.4/haricow/test/runTests.php
/usr/src/php-5.0.1/Zend/zend_variables.c(137) : Actual location (location was relayed)
Last leak repeated 32 times
/usr/src/php-5.0.1/Zend/zend_builtin_functions.c(1013) :  Freeing 0x084702C4 (16 bytes), script=/www/haricow/0.4/haricow/test/runTests.php
Last leak repeated 32 times
/usr/src/php-5.0.1/Zend/zend_execute.c(3718) :  Freeing 0x0844FA94 (44 bytes), script=/www/haricow/0.4/haricow/test/runTests.php
/usr/src/php-5.0.1/Zend/zend_variables.c(149) : Actual location (location was relayed)
Last leak repeated 1 time
/usr/src/php-5.0.1/Zend/zend_execute.c(3252) :  Freeing 0x0844DCCC (16 bytes), script=/www/haricow/0.4/haricow/test/runTests.php
Last leak repeated 7 times
/usr/src/php-5.0.1/Zend/zend_variables.c(150) :  Freeing 0x0843597C (32 bytes), script=/www/haricow/0.4/haricow/test/runTests.php
/usr/src/php-5.0.1/Zend/zend_hash.c(169) : Actual location (location was relayed)
/usr/src/php-5.0.1/Zend/zend_execute.c(3389) :  Freeing 0x084315DC (16 bytes), script=/www/haricow/0.4/haricow/test/runTests.php
/usr/src/php-5.0.1/Zend/zend_hash.c(242) :  Freeing 0x08233804 (40 bytes), script=/www/haricow/0.4/haricow/test/runTests.php
=== Total 79 memory leaks detected ===

Expected result:
----------------
No memory leaks

Actual result:
--------------
About 3 Kb of memory leaks.
I tryed to "insulate" them, but i didn't manage, because of the complexity of the script.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-12 10:36 UTC] guth at fiifo dot u-psud dot fr
I use a SimpleTest to do unit tests and it seems that it is this library which causes the memory leaks.

<?php
function simpleTestErrorHandler($severity, $message, $filename, $line) {
	restore_error_handler();
	TRUE; // Some PHP code
	set_error_handler('simpleTestErrorHandler');
}

class plip {

	public function run() {
		set_error_handler('simpleTestErrorHandler');
		trigger_error("plop", E_USER_NOTICE);
		restore_error_handler();
	}

}

$a = new plip;
for($i = 0; $i < 10000; $i++)
	$a->run();
?>

/usr/src/php5-200410111030/Zend/zend_builtin_functions.c(1058) :  Freeing 0x082D0C54 (16 bytes), script=/www/test2.php
Last leak repeated 9999 times
/usr/src/php5-200410111030/Zend/zend_variables.h(45) :  Freeing 0x082D0B84 (23 bytes), script=/www/test2.php
/usr/src/php5-200410111030/Zend/zend_variables.c(120) : Actual location (location was relayed)
Last leak repeated 9999 times
 [2005-01-07 20:51 UTC] sniper@php.net
/Zend/zend_builtin_functions.c(1097) :  Freeing 0x08965664 (16 bytes), script=t.php
Last leak repeated 9999 times
/Zend/zend_variables.h(45) :  Freeing 0x08965594 (23 bytes), script=t.php
/Zend/zend_variables.c(120) : Actual location (location was relayed)
Last leak repeated 9999 times
=== Total 20000 memory leaks detected ===

 [2005-05-07 03:11 UTC] guth at fiifo dot u-psud dot fr
/usr/src/php5-STABLE-200505070036/Zend/zend_builtin_functions.c(1090) :  Freeing 0x0824C56C (16 bytes), script=/www/test3.php
Last leak repeated 9999 times
/usr/src/php5-STABLE-200505070036/Zend/zend_builtin_functions.c(1100) :  Freeing 0x0824C49C (23 bytes), script=/www/test3.php
/usr/src/php5-STABLE-200505070036/Zend/zend_variables.c(137) : Actual location (location was relayed)
Last leak repeated 9999 times
=== Total 20000 memory leaks detected ===
 [2005-05-14 01:17 UTC] tony2001@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 23 18:01:55 2014 UTC