|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-09-23 14:29 UTC] rasmus@php.net
-Status: Open
+Status: Not a bug
[2013-09-23 14:29 UTC] rasmus@php.net
[2013-09-23 15:06 UTC] cduncan at regatta dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 08 12:00:01 2025 UTC |
Description: ------------ When executing a query that returns a large number of rows (around 16 million) the query() function appears to use a lot more memory than it did in version 5.3.8 I looked through the changelogs and couldn't find any obvious reason why, or any mention of a change in how the function works Test script: --------------- <?php $sql = new mysqli("localhost","username","password"); function checkMemory($key="") { $memory = round(memory_get_usage(true) / 1024 / 1024) . "mb"; echo "Memory " . $key . ": " . $memory . "\n"; } checkMemory("Before"); $query = "SELECT field1a, field2a, valb1, valb2, valb3, valb4 FROM test.table1 JOIN test.table2 ON companyb=companya AND field1b=field1a WHERE companya='TEST'"; $result = $sql->query($query); checkMemory("After"); $field = $result->fetch_field(); echo "End\n"; Expected result: ---------------- user@server:~$ /usr/local/php-5.3.8/bin/php memory.php Memory Before: 1mb Memory After: 1mb End Actual result: -------------- user@server:~$ /usr/local/php-5.5.4/bin/php memory.php Memory Before: 0mb Memory After: 427mb PHP Fatal error: Out of memory (allocated 1603796992) (tried to allocate 20 bytes) in /home/user/memory.php on line 17