Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors. code example
Example: composer memory limit
php -d memory_limit=512M /usr/local/bin/composer update
php -d memory_limit=512M /usr/local/bin/composer update