Skip to content
Snippets Groups Projects
Commit 22db97b1 authored by Sascha Nowak's avatar Sascha Nowak Committed by Benjamin Franzke
Browse files

[BUGFIX] Prevent memory leak when fetching a lot of database records

When fetching a lot of records from database the memory is nearly
doubled in the fetchAll function. It seems php keeps references or
creates an array copy that could not be garbage collected. Enforcing
a manuell gc_collect_cycles does not help either.

Resolves: #102986
Releases: main, 12.4, 11.5
Change-Id: I2da5f1e0126aa1dc867c8fb3074be4a11491f8f3
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82725


Tested-by: default avatarcore-ci <typo3@b13.com>
Reviewed-by: default avatarBenjamin Franzke <ben@bnf.dev>
Tested-by: default avatarBenjamin Franzke <ben@bnf.dev>
parent 6ea72054
Branches
Tags
No related merge requests found
......@@ -156,15 +156,11 @@ class DriverResult implements ResultInterface
protected function mapResourceToString($record)
{
if (is_array($record)) {
return array_map(
static function ($value) {
if (is_resource($value)) {
$value = stream_get_contents($value);
}
return $value;
},
$record
);
foreach ($record as $k => $value) {
if (is_resource($value)) {
$record[$k] = stream_get_contents($value);
}
}
}
return $record;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment