#45671 [Opn->Fbk]: nextRowset/closeCursor memory issues
ID: 45671
Updated by: jani@php.net
Reported By: dejuannonley at yahoo dot com
-Status: Open
+Status: Feedback
Bug Type: PDO related
Operating System: *
PHP Version: 5.2.6
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
Previous Comments:
------------------------------------------------------------------------
[2008-07-31 19:32:29] dejuannonley at yahoo dot com
Description:
------------
Multiple calls to nextRowset() or closeCursor() (only for PDO drivers
that support nextRowset()) greatly increases memory allocation to the
script.
I've confirmed this problem with PHP 5.2.x and 6.
These results are from using PDO_ODBC with MS-SQL 2005. PDO_MYSQL and
PDO_SQLITE would return 512 KiB no matter how many SELECT statements are
run because they don't support nextRowset().
Reproduce code:
---------------
for ($i=0; $i<1000; $i++) {
$result = $conn->query('SELECT * FROM foo');
$result->closeCursor();
}
$mem = memory_get_peak_usage(true) / 1024;
echo $mem;
// Following run in a separate script to reset mem usage
for ($i=0; $i<100000; $i++) {
$result = $conn->query('SELECT * FROM foo');
$result->closeCursor();
}
$mem = memory_get_peak_usage(true) / 1024;
echo $mem;
Expected result:
----------------
512
512
Actual result:
--------------
1536
111872
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45671&edit=1
Thread (2 messages)