Apparent Memory leak in External Stored Procedure with INOUT param w/ PHP's IBM DB2 extension 1.9.9 when binding the parameter in PHP7. When the bindparam on the out parameter is done outside of the loop memory doesn't increase.
CREATE OR REPLACE PROCEDURE MYLIB.TESTSP ( | |
IN "ID" DECIMAL(7, 0) , | |
INOUT CUSTOMERNAME CHAR(40) ) | |
LANGUAGE RPGLE | |
SPECIFIC MYLIB.TESTSP | |
NOT DETERMINISTIC | |
NO SQL | |
CALLED ON NULL INPUT | |
EXTERNAL NAME 'MYLIB/MYTESTRPG' | |
PARAMETER STYLE GENERAL ; |
<?php | |
$db2Connection = db2_connect('MYDB', 'MYUSER', 'MYPASS',array('i5_lib' => 'MYLIB')); | |
$sql = "CALL MYLIB.TESTSP(?,?)"; | |
$stmt = db2_prepare($db2Connection, $sql); | |
for ($i = 0; $i <= 20; $i++) | |
{ | |
if ($stmt) | |
{ | |
$id = 20; | |
$name = ""; | |
db2_bind_param($stmt, 1, "id", DB2_PARAM_IN); | |
db2_bind_param($stmt, 2, "name", DB2_PARAM_OUT); | |
if (db2_execute($stmt)) | |
{ | |
var_dump($name); | |
echo "<br>"; | |
echo "Memory usage: "; | |
var_dump(memory_get_usage());//Memory usage increases 64 Bytes per call, in old DB2 Memory stays constant. | |
echo "<br>"; | |
} | |
} | |
else | |
{ | |
echo "<b>Last SQL Statement Error Message:</b> ".db2_stmt_errormsg()."<br>"; | |
} | |
if($db2Connection===FALSE) | |
{ | |
echo "<b>Last Connection Error Message:</b> ".db2_conn_errormsg()."<br>"; | |
} | |
} | |
exit(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
if php variable $name is outside of the loop
$name = "";
memory doesn't increase