🔥 Just Launched! Werra Premium Template for HyväSee it in Action

Solved: Allowed Memory Size of Bytes Exhausted in Magento 2

By Jignesh ParmarUpdated on May 22, 2025 2 min read

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:

php -d memory_limit=-1 bin/magento setup:di:compile
php -d memory_limit=-1 bin/magento setup:static-content:deploy

Here, I’ve set the memory limit as “-1” which means infinite. The required memory will be occupied from the infinite memory available. You can also define an explicit value such as 2G or 5G.

Add memory limit while installing library using composer:

For this, first you’ll need to find the path of the composer the below command:

$ which composer
Screenshot-at-November-24th-2020-5.39.23-pm

It will return the path of the composer which is used as shown below:

php-d memory_limit=-1 [composer_path] require twilio/sdk

That’s it.

Also, do share the solution with Magento Community via social media.

Thank you.

Jignesh Parmar Full Image
Article byJignesh 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.