|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2019-09-11 10:45 UTC] nikic@php.net
-Status: Open
+Status: Verified
[2019-09-12 13:59 UTC] nikic@php.net
-Assigned To:
+Assigned To: nikic
[2019-09-12 13:59 UTC] nikic@php.net
[2019-09-13 12:37 UTC] nikic@php.net
[2019-09-13 12:37 UTC] nikic@php.net
-Status: Verified
+Status: Closed
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
Description: ------------ If a native prepared statement is reused, it will leak memory on each reuse. If the statement is prepared each time, there is no memory leak. All versions of PHP 7.2 works, and all versions of PHP 7.3 leaks memory. Versions: Percona MySQL 5.7 & 8.0 PHP 7.3.x Mysqlnd: mysqlnd 5.0.12-dev The call to closeCursor() doesn't change anything. Test script: --------------- $pdo = new \PDO('mysql:host=<host>;dbname=<dbname>', 'user', 'password'); $pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, false); $stmt = $pdo->prepare('SELECT field FROM table LIMIT 100'); for($i=0;$i<250000;$i++) { $stmt->execute(); $stmt->fetchAll(); //$stmt->closeCursor(); if($i%1000 === 0) print memory_get_usage()."\r\n"; } Expected result: ---------------- PHP 7.2.22: 446824 446856 446856 446856 446856 446856 446856 446856 446856 446856 446856 446856 446856 446856 446856 Actual result: -------------- PHP 7.3.9: 479176 970728 1445864 1937384 2428904 2920424 3411944 3903464 4378600 4870120 5361640 5853160 6344680 6836200 7327720