Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 97b321b

Browse files
committed
fix memory leak
1 parent 07a891f commit 97b321b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Symfony/Component/Cache/Traits/AbstractAdapterTrait.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,10 @@ private function generateItems(iterable $items, array &$keys): \Generator
364364

365365
private function getId($key)
366366
{
367+
if (count($this->ids) > 1000) {
368+
array_splice($this->ids, 0, 500); // stop memory leak if there are many keys
369+
}
370+
367371
if ($this->versioningIsEnabled && '' === $this->namespaceVersion) {
368372
$this->ids = [];
369373
$this->namespaceVersion = '1'.static::NS_SEPARATOR;

0 commit comments

Comments
 (0)