Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

geetpurwar's avatar

Composer Update - Out of Memory

Hi,

I am trying to running composer update and ubuntu based server with 1GB RAM shows following error.

mmap() failed: [12] Cannot allocate memory
PHP Fatal error:  Out of memory (allocated 695214080) (tried to allocate 4096 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleWatchGraph.php on line 52

Fatal error: Out of memory (allocated 695214080) (tried to allocate 4096 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleWatchGraph.php on line 52

Command : free -h

root@Lumber-Tumber:/var/www/lumberdev# free -h
              total        used        free      shared  buff/cache   available
Mem:           992M        242M        639M         31M        109M        600M
Swap:            0B          0B          0B

Please advise. Thanks.

0 likes
4 replies
diegoaurino's avatar

Hello, @geetpurwar!

Are you running the server on SSD? If not, you should enable a swap file.

You can also run:

ps aux

Thus, you can check if another service is consuming memory.

Let me know if it helps.

munazzil's avatar

Try with below command

       composer update --no-scripts
geetpurwar's avatar

Thank you. I have to enable swap. That worked.

dongun's avatar

Sorry how were u able to enable the swap??

Please or to participate in this conversation.