PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » DB_DataObject » Bug #4724

memory leak when using function query with DB_Dataobject

Details

Submitted2005-07-01 14:37 UTC
Fromjdelahayes at tf1 dot fr
StatusBogus
PackageDB_DataObject
PHP Version5_1 CVS-2005-07-01
OSfedora core 3
Roadmaps(Not assigned)

Comments

[2005-07-01 14:37 UTC] jdelahayes at tf1 dot fr

Description:
------------
When where are using DB_DataObject query function, in a loop, the httpd process make a memory leak.

PHP 5.1.0b2
Apache 2.0.54
DB 1.7.6
DB_DataObject 1.7.14
PEAR 1.3.5

Reproduce code:
---------------
Here is the sample code to reproduce the problem of memory leak:
<?php
error_reporting(E_ALL);
require_once("../phplib/DBO/classes/Guide_reglement.php");
$options = &PEAR::getStaticProperty('DB_DataObject','options');
$config = parse_ini_file('/home/mboutillier/ECLIPSE_WS/IXIAM/conf/dbo.ini',TRUE);
$options = $config['DB_DataObject'];
$sqlQuery="SELECT guide_reglement_num,guide_reglement_code,
guide_reglement_libelle,guide_reglement_montant_min,
p.param_pays_interdit_gnxcode from guide_reglement g,
param_pays_interdit p where g.guide_reglement_interdiction=p.param_pays_interdit_num
and guide_reglement_date_debut<=CURDATE()
and guide_reglement_date_fin>=CURDATE()
and guide_reglement_statut='ACT'
and guide_reglement_mode_paiement_num=1";

for($i=0; $i<5000; $i++) {
$guideReglement = new DBO_Guide_reglement();
$guideReglement->query($sqlQuery);
$guideReglement->fetch();
unset($guideReglement);
}

?>

Expected result:
----------------
No memory leak !

Actual result:
--------------
the httpd process make a memory leak. It take 200Mo of RAM at the end of the execution of the sample.

[2005-07-06 13:17 UTC] jdelahayes at tf1 dot fr

The problem is solved by using free function.
Thank's a lot for your help.