Reputation: 61
I have Symfony app which is built on Symfony 3, but recently I upgraded to Symfony 4. Now I have a problem when clearing cache. When I run command to clear cache I'm getting this error:
PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 32768 bytes) in var/cache/dev/ContainerGGUArAR/getDoctrine_Orm_DefaultEntityManagerService.php on line 85.
php.ini memory_limit
is set to -1.
I found that ServiceEntityRepository
is causing the problem, because when I extend this service to one repository I get this error.
Does somebody know what should I try to fix it?
Just to mention that memory_limit
is set also for CLI to be unlimited
Upvotes: 1
Views: 3117
Reputation: 3396
It is not the solution to the core of your problem but probably allows you to clear the cache even with very large contents:
Try
php -d memory_limit=-1 bin/console cache:clear
or when console is in app/ folder
php -d memory_limit=-1 app/console cache:clear
Or
rm -rf var/cache
or when cache is in app/ folder
rm -rf app/cache
I use "rm" very often instead of the bin/console command. This does not do any cache warmup so the loading of the first page will take longer. Sometimes I get better results clearing cache manually in comparison of the bin/console command...
Upvotes: 3