1

I have memory error in Ubuntu hosting(I created it a pair of weeks ago) under Digital Ocean:

root@ubuntu-boxBooking-Dev:/var/www/html/box-booking# lsb_release -d; uname -r; uname -i
Description:    Ubuntu 16.04.4 LTS
4.4.0-130-generic
x86_64

root@ubuntu-boxBooking-Dev:/var/www/html/box-booking# free -m
              total        used        free      shared  buff/cache   available
Mem:            992         325         562          35         104         518
Swap:             0           0           0

I had laravel 5.5 app installed. I pulled changes from git and had to install intervention/image :

# composer require intervention/image 

Using version ^2.4 for intervention/image
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)

mmap() failed: [12] Cannot allocate memory

mmap() failed: [12] Cannot allocate memory
PHP Fatal error:  Out of memory (allocated 586162176) (tried to allocate 20480 bytes) in /usr/share/php/Composer/DependencyResolver/Rule.php on line 66

Fatal error: Out of memory (allocated 586162176) (tried to allocate 20480 bytes) in /usr/share/php/Composer/DependencyResolver/Rule.php on line 66
root@ubuntu-boxBooking-Dev:/var/www/html/box-booking# 
root@ubuntu-boxBooking-Dev:/var/www/html/box-booking# lsb_release -d; uname -r; uname -i

Also I tried:

# composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Removing doctrine/dbal (v2.6.3)
The following exception is caused by a lack of memory and not having swap configured
Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details

I see not having swap configured error description above and 0 value in free command above. Is it issue and how to fix it?

Also installing Ubuntu hosting under Digital Ocean I did not notice any swap options...

Aslo can be rebooting of the system salve the problem? Usually I reboot the ubuntu(I use kubuntu 18 on my laptop) running under root:

reboot

Is it what I have to run in my case or other command preferable?

Thanks!

1 Answer 1

3

Adding swap seems to be the only fix as of now. Ref: https://github.com/composer/composer/issues/1898

Process:

df -h 
sudo dd if=/dev/zero of=/swapfile bs=1M count=1024
sudo mkswap /swapfile
sudo chmod 600 /swapfile
sudo swapon /swapfile
echo 'echo "/swapfile  none  swap  defaults  0  0" >> /etc/fstab' | sudo sh

free -m
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.