I have bypassed the problem in a Homestead Laravel (vagrant) virtual machine running the composer commands preceded by COMPOSER_MEMORY_LIMIT=-1
:
Examples
To update Composer:
COMPOSER_MEMORY_LIMIT=-1 composer update
To install a package:
COMPOSER_MEMORY_LIMIT=-1 composer require spatie/laravel-translatable