Composer Cannot Allocate Memory

I using composer to setup extension, but it error Cannot Allocate Memory. I was set memory_limit=-1, but it not run.

Hi @duypham2991 and welcome.

I don’t recommend the use of memory_limit=-1

1. Ensure you have enough available Memory

First, make sure your server has a minimum of 2GB of available Memory so that composer can be run without hanging ("out of memory").

2. Allocate a temporary swap file

If you do have a minimum of 2GB of available Memory, then try to allocate a temporary swap file. You’ll find the 4 steps to do this here: Magento install Composer #5 install error