php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28978 multiple OCIBindByName on same placeholder eats memory
Submitted: 2004-06-30 21:44 UTC Modified: 2004-07-15 08:09 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: pumuckel at metropolis dot de Assigned: tony2001 (profile)
Status: Closed Package: OCI8 related
PHP Version: 4.3.7 OS: Linux
Private report: No CVE-ID: None
 [2004-06-30 21:44 UTC] pumuckel at metropolis dot de
Description:
------------
Calling OCIBindByName on the same placeholder (same statement) does eat memory. The expected behaviour should be to just replace the old placeholder variable with the new one, without any new memory allocation needed.

Reproduce code:
---------------
<?
  // http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96584/oci05bnd.htm#421792
  ob_end_flush();
  ob_implicit_flush(1);

  $conn = OCILogon("scott", "tiger", "database");
  $stmt = OCIParse($conn, "SELECT DUMMY FROM DUAL WHERE DUMMY=:DUMMY");
  $i = 1;
  while($i++) {
    OCIBindByName($stmt, ":DUMMY", &$dummy, 1);
    if ($i%500 == 0)
    echo "\rMEM -send $i: ".memory_get_usage();
  }
?>


Expected result:
----------------
The memory usage shouldn't grow.
A second call to ocibindbyname on the same placeholder should free/replace the old php internal bind variable (in oci8.c) for this placeholder...

Actual result:
--------------
actual a new bind place holder is allocated and added to the list of bind variables.

./bug.php
MEM -send 122500: 8387128
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 20 bytes) in /user/bug.php on line 16


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-05 11:33 UTC] tony2001@php.net
I'll take a look at it.
 [2004-07-12 09:42 UTC] tony2001@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 [2004-07-15 01:46 UTC] pumuckel at metropolis dot de
Changes are not committed to 4.3.8 :-(
 [2004-07-15 08:09 UTC] tony2001@php.net
Yep, I consider it more as a feature request, than a bugfix, so I think it should go into HEAD only.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 18:01:28 2024 UTC