When I put a large image folder in my /web folder
, the "cache"clear"
command fails with a
"OutOfMemoryException"
PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 151552 bytes) in /Users/john/Development/git/website/vendor/twig/twig/lib/Twig/Compiler.php on line 124
[Symfony\Component\Debug\Exception\OutOfMemoryException]
Error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 151552 bytes)
Exception trace:
() at /Users/john/Development/git/website/vendor/twig/twig/lib/Twig/Compiler.php:124
The image folder contains 10.000 images and is about 600MB big. When I delete this folder, the "cache:clear" command runs successfully.
I'm using Symfony 2.8
with PHP 7.1
. The PHP memory limit is set on 512MB, which is the maximum on my hosting.
Update:
When I add --no-warmup
to the command, I don't get the exception
.
$ php app/console cache:clear --verbose --no-warmup
You can limit the usage of the php command like this:
php -d memory_limit=512M app/console cache:clear --verbose --no-warmup
Hope this works for you :)