php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45671 nextRowset/closeCursor memory issues
Submitted: 2008-07-31 19:32 UTC Modified: 2009-05-03 01:00 UTC
Votes:3
Avg. Score:3.0 ± 1.6
Reproduced:3 of 3 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (33.3%)
From: dejuannonley at yahoo dot com Assigned:
Status: No Feedback Package: PDO related
PHP Version: 5.2.6 OS: *
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2008-07-31 19:32 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-04-25 15:10 UTC] jani@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-05-03 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 13:01:30 2024 UTC