Rather than permanently setting your memory limit to an increased number (or unlimited), I use this;
# Running an update
COMPOSER_MEMORY_LIMIT=-1 composer update
COMPOSER_MEMORY_LIMIT=-1 composer require PACKAGE/NAME
That temporarily set's the composer memory limit env variable to unlimited.