PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB_DataObject » Bug #9525

$o->free() not working when $o->count()

Details

Submitted2006-12-01 20:43 UTC
Fromjensg at subsist dot de
StatusClosed
PackageDB_DataObject
PHP Version4.3.10
OSDebian sarge
Roadmaps(Not assigned)

Comments

[2006-12-01 20:43 UTC] jensg at subsist dot de

Description:
------------
I did many count queries on a large table. The calling of free() seems to do nothing when used with count() like in my test. Outputing your global $_DB_DATAOBJECT at the end shows a big amount of data within $_DB_DATAOBJECT[RESULTS] which should be not there after calling free(). The amount of memory which is used is increased at a very high rate. (memory_get_usage() with 10000 iterations from 3 to 14 MB, also top is reporting a Virt size rise from around 20MB to 120MB!!! which I find also very interesting)
If I change $tobj->count() to $tobj->find() free() works and the memory is almost constant.

Test script:
---------------
$tobj = &DB_DataObject::factory('Table');
//ids array holds many ID's
foreach ($ids as $v) {
$tobj->a_id = $v;
$num = $tobj->count();
$xnews->free();
}

Expected result:
----------------
constant memory consumation

[2007-02-05 11:26 UTC] jensg at subsist dot de

its working for me