Bug #77599 [Opn->Ver]: Unbuffered queries; native prepared statements memory leak

From: Date: Mon, 11 Feb 2019 09:38:22 +0000
Subject: Bug #77599 [Opn->Ver]: Unbuffered queries; native prepared statements memory leak
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-219494@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77599&edit=1 ID: 77599 Updated by: nikic@php.net Reported by: dylan at php dot waywardrambler dot com Summary: Unbuffered queries; native prepared statements memory leak -Status: Open +Status: Verified Type: Bug Package: PDO MySQL Operating System: MacOS 10.14.3 PHP Version: 7.3.2 -Assigned To: +Assigned To: dmitry Block user comment: N Private report: N New Comment: You're right. It looks like unbuffered queries + emulated prepares no longer leask, but unbuffered queries + native prepares still leaks. Previous Comments: ------------------------------------------------------------------------ [2019-02-11 09:23:15] dylan at php dot waywardrambler dot com Fairly sure "PHP 7.3.2 (cli) (built: Feb 5 2019 22:19:09) ( NTS )". I have also checked on the official 7.3.2-cli container and the issue is still present. ------------------------------------------------------------------------ [2019-02-11 08:19:40] nikic@php.net Are you sure that you're really using PHP 7.3.2 and not PHP 7.3.1? This bug is supposed to be fixed. ------------------------------------------------------------------------ [2019-02-11 03:23:54] dylan at php dot waywardrambler dot com Description: ------------ Memory leak when running unbuffered queries in PDO with ATTR_EMULATE_PREPARES set to false. Test script: --------------- <?php ini_set('memory_limit', '16M'); $pdo = new PDO('mysql:host=*;dbname=*', '*', '*'); $pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $pdo->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false); $result = $pdo->query("SELECT * FROM large_table"); foreach ($result as $i => $row) if ($i % 10000 === 0) printf("%10s %10s\n", $i, memory_get_usage()); Expected result: ---------------- consistent memory usage, eg: 0 2097152 10000 2097152 20000 2097152 30000 2097152 40000 2097152 Actual result: -------------- 0 2097152 10000 4194304 20000 8388608 30000 12582912 40000 14680064 Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 16384 bytes) in /php on line 10 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77599&edit=1

« previous php.bugs (#219494) next »