Bug #76053 [Opn->Csd]: Memory leaks when executing prepared statements

From: Date: Tue, 06 Mar 2018 19:03:49 +0000
Subject: Bug #76053 [Opn->Csd]: Memory leaks when executing prepared statements
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214226@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76053&edit=1 ID: 76053 User updated by: hello at spaceemotion dot net Reported by: hello at spaceemotion dot net Summary: Memory leaks when executing prepared statements -Status: Open +Status: Closed Type: Bug Package: PDO MySQL Operating System: Ubuntu -PHP Version: 7.2Git-2018-03-05 (snap) +PHP Version: 7.2.2 Block user comment: N Private report: N New Comment: This was actually a problem with the Laravel Homestead Box where Zend Z-Ray was also enabled for the CLI. Fixed by https://github.com/laravel/settler/pull/145 Previous Comments: ------------------------------------------------------------------------ [2018-03-05 16:50:24] hello at spaceemotion dot net Description: ------------ I've just come across an out of memory issue in a larger CLI-command that does lots calculations across multiple tables. The command ran fine on 7.1.x but errors on 7.2.2. I've nailed it down to the PDOStatement class (using Blackfire.io) sometimes creating 26 kb garbage _per call_. The attached test script should not create any garbage whatsoever, and even the gc_collect_cycles call does not reduce the memory footprint. Everything works when running it under 7.1. Opcache is disabled (for CLI). Test script: --------------- <?php $dsn = 'mysql:dbname=homestead;host=127.0.0.1'; $user = 'homestead'; $password = 'secret'; $pdo = new PDO($dsn, $user, $password); for($i = 0; $i < 1000000; $i++) { echo memory_get_usage() . "\n"; $statement = $pdo->prepare('SELECT * FROM demo'); $statement->execute(); gc_collect_cycles(); // does not help as well } Expected result: ---------------- 362504 107678504 107678504 107678504 107678504 107678504 107678504 107678504 Actual result: -------------- 574888 100246184 100246312 100246440 100246568 100246696 100246824 100246952 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76053&edit=1

« previous php.bugs (#214226) next »