Solved: Allowed Memory Size of Bytes Exhausted in Magento 2
Ever faced an error that says:
Allowed memory size of 1610612736 bytes exhausted (tried to allocate 134217736 bytes) in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/DependencyResolver/RuleSet.php on line 83
You might have faced this error while running the static content deploy or compilation command. Moreover, while installing a library using a composer, the memory exhausted error occurs.
This is due to the limited memory of your localhost or live site. The library you are installing may require more memory limit for successful installation which is not available and hence the error occurs.
The solution for this error is to directly increase the memory limit using the command given in this post.
Solution for Allowed Memory Size of Bytes Exhausted in Magento 2:
Add memory limit in the command:
1 |
php -d memory_limit=-1 bin/magento setup:di:compile |
1 |
php -d memory_limit=-1 bin/magento setup:static-content:deploy |
Add memory limit while installing library using composer:
For this, first you’ll need to find the path of the composer the below command:
1 |
$ which composer |
It will return the path of the composer which is used as shown below:
1 |
php-d memory_limit=-1 [composer_path] require twilio/sdk |
That’s it.
Any doubts about the memory limit error for Magento 2 console command?
If so, do mention it in the Comments section below. I’d be happy to help.
Also, do share the solution with Magento Community via social media.
Thank you.
Jignesh Parmar
An expert in his field, Jignesh is the team leader at Meetanshi and a certified Magento developer. His passion for Magento has inspired others in the team too. Apart from work, he is a cricket lover.
2 Comments
Hi
Should those commands being in Magento root directory
Thanks for any help
Hello Roman,
Yes, pass command in the root directory.
Thank You