Edit report at https://bugs.php.net/bug.php?id=51796&edit=1
ID: 51796 Updated by: php-bugs@lists.php.net Reported by: J dot Antonio at jaruz dot com Summary: Memory leak when executing SQL "EXEC" statements -Status: Feedback +Status: No Feedback Type: Bug Package: PDO related Operating System: Ubuntu 10.04 LTS PHP Version: 5.3.2 New Comment: No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. Previous Comments: ------------------------------------------------------------------------ [2010-05-12 18:43:37] s...@php.net Try the patches and see if your bug is a duplicate. ------------------------------------------------------------------------ [2010-05-12 18:41:32] s...@php.net For reference, there are some pdo_dblib patches mentioned in http://bugs.php.net/50755 ------------------------------------------------------------------------ [2010-05-11 17:50:44] J dot Antonio at jaruz dot com I forgot to mention this is using PDO_DBLIB. ------------------------------------------------------------------------ [2010-05-11 17:48:35] J dot Antonio at jaruz dot com Description: ------------ On Linux, using PHP 5.3.2-1ubuntu4 with Suhosin-Patch (cli) and FreeTDS 0.82-6build1 (it's a vanilla lucid install, fully up to date): When executing stored procedures using the "EXEC" SQL statement, both PDOStatement->execute as well as PDO::query seem to have a memory leak. We found this while executing a stored procedure within a loop: memory usage just kept increasing till the memory limit was reached. Unsetting/nullyfing variables does not help. The leak is not present (memory usage stays perfectly constant) when using a "SELECT" SQL statement (which returns the exact same results as the stored procedure). I have a feeling PDO is maybe only clearing the memory when it deals with a "SELECT" statement, and it misses the fact that data can also come back through "EXEC" statements? This bug might be slightly related to bug 50755. Test script: --------------- // $polyItemArray is populated with a list of 300 IDs (integers). // We loop through the array, and execute a stored procedure during each iteration: foreach( $polyItemArray as $polyItemKey => $polyItem) { echo date('H:i:s') . ' | Processing: ' . $polyItem['sgp_id']; $dbh->query('EXEC proc_map_get_sgp_polygons ' . $polyItem['sgp_id'], PDO::FETCH_ASSOC); /* // Alternate way of calling the procedure using PDOStatement; same leak is present: $stmt = $dbh->prepare($sql); $stmt->setFetchMode(PDO::FETCH_ASSOC); $stmt->execute( array($polyItem['sgp_id']) ); $stmt->closeCursor(); unset($stmt); */ unset($polyItemKey); unset($polyItem); echo ' memory usage: ' . memory_get_usage(). ' bytes'. PHP_EOL; } // When running the script, memory usage just keeps increasing. Expected result: ---------------- I would expect the memory usage of the script to stay constant. Actual result: -------------- Memory usage just keeps increasing. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=51796&edit=1