Fatal error “Allowed memory size” while run setup:static-content:deploy

The question:

I am trying to setup Magento 2.0 (community) in a WAMP server and I am getting the error below all the time while I run the command for deploy the assets static due to symlink issues at Windows environments:

php bin/magento setup:static-content:deploy

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 64 bytes) in C:wampwwwmagentovendoroyejorgeless.phplibLessVisitorprocessExtends.php on line 445

I have setup memory_limit as -1 (no limit) but this takes no changes. I don’t know what else to do in this case since the issue goes beyond my PHP knowledge and setting that value to no limit should do the job unless I need to install something else to get this working. Any advices? Any workaround?

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

quick solution add memory size in the command :

php -dmemory_limit=6G bin/magento setup:static-content:deploy

change 6G to what you want

Method 2

In dev mode I managed to solve this issue by running the following command:
rm -rf pub/static/* var/di var/generation var/cache var/page_cache

Method 3

Increase the memory limit to update .php.ini file

If you have access to your php.ini file or can create one in the root, you can globally increase your allocated memory.

;adjust memory limit
memory_limit = 6G
max_execution_time = 36000
max_input_time = 36000

If you not want to update .php.ini file then use below command

php -dmemory_limit=6G bin/magento setup:static-content:deploy


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment