From:             galaxy dot mipt at gmail dot com
Operating system: Linux
PHP version:      5.4.4
Package:          OCI8 related
Bug Type:         Bug
Bug description:OCI8 statement not fully freed if bind data contains references

Description:
------------
Probably I miss some point here but anyway - in the test script below bind
data is passed to the query() function as an array from pre-created
collection.
On each call memory consumption grows by pretty huge value (~65kB) even
though oci_free_statement() is called.
The important conditions to reproduce:
  1. Bind array contains references. Without those I get
    639500
    639520

  2. PL/SQL script actually writes to one of bound variables. With the
second (currently commented out) version I get
    639516
    657136


Test script:
---------------
function query($data) {
    global $conn;
    $stid = oci_parse($conn, 'begin select :a + :b into :b from dual;
end;');
    //$stid = oci_parse($conn, 'declare j number; begin select :a + :b into
j from dual; end;');

    oci_bind_by_name($stid, ':a', $data['a'], 100);
    oci_bind_by_name($stid, ':b', $data['b'], 100);

    oci_execute($stid);
    oci_free_statement($stid);
}

$conn = oci_connect('user', 'pass', 'dbref');
if (!$conn) {
    $e = oci_error();
    die($e['message']);
}

$data = array();
for($i = 0; $i < 1000; $i++) {
    $data[] = array(
        "a"   => 1,
        "b"   => 2
    );
}

print memory_get_usage() . "\n";
for($i = 0; $i < 100; $i++) {
    query(
        array(
            "a" => &$data[$i]["a"],
            "b" => &$data[$i]["b"]
        )
    );
}
print memory_get_usage() . "\n";

oci_close($conn);

Expected result:
----------------
639500
7202720

Actual result:
--------------
639500
639520 or nor far from this

-- 
Edit bug report at https://bugs.php.net/bug.php?id=62367&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=62367&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=62367&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=62367&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=62367&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=62367&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=62367&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=62367&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=62367&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=62367&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=62367&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=62367&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=62367&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=62367&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=62367&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=62367&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=62367&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=62367&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=62367&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=62367&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=62367&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=62367&r=mysqlcfg

Reply via email to