|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77713 Memory exhausted using mysqli_use_result()
Submitted: 2019-03-08 19:29 UTC Modified: 2019-03-22 12:15 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: data dot protection dot gdpr at gmail dot com Assigned:
Status: Duplicate Package: MySQLi related
PHP Version: 7.3.3 OS: CentOS 6
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: data dot protection dot gdpr at gmail dot com
New email:
PHP Version: OS:


 [2019-03-08 19:29 UTC] data dot protection dot gdpr at gmail dot com
In PHP 7.2, this was running very well.

Since the upgrade to PHP 7.3, very quickly I get a "memory exhausted" error in the mysqli_fetch_assoc() call, at around result #850000.
Increasing "memory_limit" helps getting more results, but the error is always on mysqli_fetch_assoc(), so I'm very confident the problem is there.

The data retrieved by the SELECT is very small (no big blobs), so there is no bad row that I'm hitting that causes the memory issue.

Isn't the point of "use_result" not putting everything in memory and being able to go through huge amount of results?

Am I doing something wrong? Is there a way to flush the previous read results?

Test script:
mysqli_real_query($conn, 'SELECT id, name FROM big_table WHERE ... ORDER BY ... LIMIT 1500000);
$result = mysqli_use_result($conn);
<... error handling here ...>

while ($row = mysqli_fetch_assoc($result)) {
 <... do stuff ...>


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-03-15 16:50 UTC] data dot protection dot gdpr at gmail dot com
Just to confirm, I reverted to PHP 7.2 and put "memory_limit" back to default. The process works fine now.

Then I upgraded again to PHP 7.3, and I get the "memory exhausted" error again.
 [2019-03-22 12:15 UTC]
-Status: Open +Status: Duplicate
 [2019-03-22 12:15 UTC]
Same issue as bug #77773, which should be fixed now.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Dec 05 04:05:52 2022 UTC