This error may happen when running
composer update or the first time you run
composer install. The reason is that Composer requires a lot of memory to
resolve the dependencies of your application.
Instead of increasing the global memory limit of PHP, it's better to increase that limit temporarily only during the execution of Composer's commands:
# before $ composer update # after $ php -d memory_limit=1024M composer update