Skip to content

Commit e2eb098

Browse files
Peter Wardnicolas-grekas
authored andcommitted
Add gc_mem_caches() call for PHP7 after itoken_get_all() as new memory manager will not release small buckets to OS automatically
1 parent f07ff79 commit e2eb098

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Translation/PhpExtractor.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ public function extract($directory, MessageCatalogue $catalog)
6161
$files = $finder->files()->name('*.php')->in($directory);
6262
foreach ($files as $file) {
6363
$this->parseTokens(token_get_all(file_get_contents($file)), $catalog);
64+
65+
if (PHP_VERSION_ID >= 70000) {
66+
// PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098
67+
gc_mem_caches();
68+
}
6469
}
6570
}
6671

0 commit comments

Comments
 (0)