How to fix: Allocated Memory Size Exhausted for Composer
Working with framework like Laravel we are using composer to install various packages that can extend the functionality of our applications.
Most of the time we ran into an error when trying to install a package via composer and the error looks like this:
You can check the allocated php memory via the following command:
php -r "echo ini_get('memory_limit').PHP_EOL;"
In order to solve this issue, either you can increase the php allocated memory to:
; Use -1 for unlimited
memory_limit = -1
OR, you can use the COMPOSER_MEMORY_LIMIT=-1
parameter with your composer command and an example would be like this:
COMPOSER_MEMORY_LIMIT=-1 composer require laravel/scout