From:             dejuannonley at yahoo dot com
Operating system: Win/Lin
PHP version:      5.2.6
PHP Bug Type:     PDO related
Bug description:  nextRowset/closeCursor memory issues

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 bug report at http://bugs.php.net/?id=45671&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=45671&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=45671&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=45671&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45671&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=45671&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45671&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45671&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45671&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45671&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45671&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=45671&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=45671&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45671&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45671&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45671&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45671&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45671&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45671&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45671&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45671&r=mysqlcfg

Reply via email to