I have faced the same issue. I am on a AWS Free Microinstance which has less memory. I always try one of the below options and it always works (Before all this please check if you have the latest version of composer installed)
sudo php -dmemory_limit=750M composer.phar update
or remove the contents of the vendor folder and try composer update.
sudo rm -rf vendor sudo php -dmemory_limit=750M composer.phar update --no-scripts --prefer-dist sudo php artisan --dump-autoload
The second option tries to update all the components, if there is no update, it picks up the package from the cache else picks up from the dist
Note: Please change the memory limit as per your choice.
Create a swap partition and try. Swap partition is the portion of the hard drive that linux uses as virtual memory when it runs out of physical memory. It's similar to the windows swap file only instead of using an actual file, linux uses a partition on the hard drive instead.
Hope this helps