When I try to execute a command, I will encounter the following error by commandline

mmap() failed: [12] Cannot allocate memory

  • try this php bin/magento -dmemory_limit=2G {{your comand}} – kunj Jun 5 '18 at 10:09
  • Hello I tried this method but it was still not helpful – Salman Aghaei Jun 9 '18 at 9:22
  • That error for each and every command or for a particular command. – kunj Jun 9 '18 at 11:11
  • For each command – Salman Aghaei Jun 9 '18 at 18:03
  • May I know ram? Magento need 2GB means you should have 8GB ram. – kunj Jun 10 '18 at 4:34

Try this and add dmemory_limit:

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

Try this:

php bin/magento -dmemory_limit=2G {{your command}}.

-dmemory_limit=2G this will extend memory for command execution.

  • my cron is generating this error. how to fix this issue with cron. – Niraj Nagar Mar 20 at 5:00
  • for cron you need to increase memory limit from server. – kunj Mar 20 at 12:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.