Out of memory error during install or upgrade

This article talks about solutions for the out of memory error during installing/upgrading Adobe Commerce on-premises and Magento Open Source on-premises products.

Affected products and versions

  • Adobe Commerce on-premises 2.3.x
  • Magento Open Source on-premises 2.3.x

Issue

When installing or updating the Adobe Commerce or Magento Open Source application or components like extensions, themes, or language packages, using the Web Setup Wizard, an error similar to the following displays:

Could not complete update {"components":[
{"name":"magento/module-bundle-sample-data","version":"100.1.0"}
]} successfully: proc_open(): fork failed - Cannot allocate memory

The error

proc_open(): fork failed - Cannot allocate memory

can also display on the command line.

Solution solution

We recommend you allocate 2GB of memory to PHP in our developer documentation to make sure your installation or upgrade succeeds.

If you’ve already done that, create a swap file on your machine. A Linux machine uses swap space if it needs more memory resources and the RAM is full. The swap space is used for inactive pages in memory.

The following are suggestions only; other options might be available. Consult a network administrator or another knowledgeable resource before you continue. You must run the commands to create a swap file as a user with root privileges.

Swap file on Ubuntu swap-file-on-ubuntu

Use the fallocate command as discussed in these references:

Swap file on CentOS swap-file-on-centos

Use the mkswap command as discussed in these references:

recommendation-more-help
8bd06ef0-b3d5-4137-b74e-d7b00485808a