DEV Community

Ibrar Hussain
Ibrar Hussain

Posted on

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:
Allocated memory size exhausted

You can check the allocated php memory via the following command:

php -r "echo ini_get('memory_limit').PHP_EOL;"
Enter fullscreen mode Exit fullscreen mode

In order to solve this issue, either you can increase the php allocated memory to:

; Use -1 for unlimited
memory_limit = -1
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Top comments (0)