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

Skip to content

Commit 881275c

Browse files
committed
fix memory leak
1 parent 07a891f commit 881275c

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
@@ -385,6 +385,10 @@ private function getId($key)
385385
\assert('' !== CacheItem::validateKey($key));
386386
$this->ids[$key] = $key;
387387

388+
if (\count($this->ids) > 1000) {
389+
array_splice($this->ids, 0, 500); // stop memory leak if there are many keys
390+
}
391+
388392
if (null === $this->maxIdLength) {
389393
return $this->namespace.$this->namespaceVersion.$key;
390394
}

0 commit comments

Comments
 (0)