|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-01-07 11:05 UTC] thomas dot kosel at aspera dot com
[2020-12-18 09:42 UTC] nikic@php.net
-Status: Open
+Status: Feedback
[2020-12-18 09:42 UTC] nikic@php.net
[2020-12-27 04:22 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 19 11:00:01 2025 UTC |
Description: ------------ MySQLi prepared statement execution in a loop increases memory consumption rapidly constantly. Test script: --------------- $now = microtime(true); $db = new \Mysqli("localhost", "root", "password", "database", 3306); $stmt = $db->prepare("SELECT * FROM someTable WHERE id=?"); $stmt->bind_param("i", $id); for( $id=1; $id<1000; $id++ ) { $stmt->execute(); $result = $stmt->get_result(); $stmt->free_result(); } echo "Time taken: ".(microtime(true)-$now)." seconds\n"; echo "Peak memory usage: ".number_format(memory_get_peak_usage())." bytes\n"; Expected result: ---------------- Memory usage should peak and stay around 400 KBs. Actual result: -------------- Memory usage constantly grows.