Explanation of Diagnosis:
When I run a similar process with a simple PDO object, I do not get the same memory allocation issues. Here is the PDO code I was using to check:
$conn = new PDO('ibm:MYDEVENV', 'MYUSERNAME', 'MYPASSWORD');
$result = $conn->query('select ACCT_UNIT from MYLIBRARY.MYTABLE where MYVALUE = 113;');
if (!$result) {
var_dump($conn->errorInfo());
}
while ($row = $result->fetch()) {
var_dump($row);
}
The query should return the value it was passed as a parameter inside an associative array:
["ACCT_UNIT" => "113"]
Actual results
I received the following error:
mmap() failed: [12] Cannot allocate memory
PHP Fatal error: Out of memory (allocated 2097152) (tried to allocate 140346646331424 bytes) in /tmp/vendor/zendframework/zend-db/src/Adapter/Driver/Pdo/Connection.php on line 425
Provide a narrative description of what you are trying to accomplish.
There appears to be a memory leak issue when connecting to a DB2 database via the DB2 Connect driver while using the Zend DB package.
OS: Ubuntu 18.04.1 LTS PHP Version: PHP 7.2.19-0ubuntu0.18.04.2 (cli) (built: Aug 12 2019 19:34:28) ( NTS ) DB2 Connect Version: 11.1
Explanation of Diagnosis: When I run a similar process with a simple PDO object, I do not get the same memory allocation issues. Here is the PDO code I was using to check:
The outcome is as expected:
When this database connection and query are run using Zend-Db package, a memory allocation error is thrown. See below:
Code to reproduce the issue
Expected results
The query should return the value it was passed as a parameter inside an associative array: ["ACCT_UNIT" => "113"]
Actual results
I received the following error: