ID: 48525
Updated by: [email protected]
Reported By: i-devolder at jm-bruneau dot be
Status: Open
Bug Type: PDO related
Operating System: Linux 2.6.26 ( Debian )
PHP Version: 5.3.0RC2
New Comment:
If you build without mysqlnd then you use libmysql and
memory_get_usage() doesn't count the memory allocated by libmysql. So
memory_get_usage() can give you a hint how much memory is used by the
script but is not the ultimative source of informaion.
I check last week mysqlnd with debug enabled and in some cases where
mysqlnd wants 52 bytes to be allocated Zend allocates 102, which means
the memory usage is doubled. Can't say exactly for optimized builds,
could be different.
Previous Comments:
------------------------------------------------------------------------
[2009-06-11 10:10:51] i-devolder at jm-bruneau dot be
the problem also occurs with mysqli
My Colleague rebuilt the latest trunk without mysqlnd
there we have a consistent memory usage
so the problem is in the mysqlnd
------------------------------------------------------------------------
[2009-06-11 07:04:49] i-devolder at jm-bruneau dot be
Description:
------------
When running a query the memoryusage keeps on rising, discovered with
huge resultsets
Reproduce code:
---------------
$test = new PDO( $dsn , $usr , $pss );
$sql = "SELECT * FROM tech_eciffOkcab.crawlPriceComp";
$stmt = $test->prepare( $sql );
$stmt->execute();
while( $row = $stmt->fetch( PDO::FETCH_ASSOC ) ) {
echo memory_get_usage()."\n";
}
Expected result:
----------------
57752
57752
57752
57752
57752
57752
57752
57752
57752
57752
output from php 5.2.9, memory usage stays the same
Actual result:
--------------
33552328
33552440
33552552
33552664
33552776
33552888
33553000
PHP Fatal error: Allowed memory size of 33554432 bytes exhausted
(tried to allocate 20 bytes) in
/home/idev/web/private/cmdscripts/testmem.php on line 16
output from php 5.3RC2, memory usage keeps increasing ( this is on a
table with 1.2 million records
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48525&edit=1