This one has been bugging me for months.
My development environment is running on MAMP on OS X. It's worked absolutely find for ages but for no reason that I can identify all my Craft sites now throw the following error when trying to apply updates via the craft cli:
./craft update craft [snip] Performing update with Composer ... PHP Fatal Error 'yii\base\ErrorException' with message 'Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes)'
Doesn't matter how much memory I give php, it will always eat it all up, exmaple of silly about of memory:
php -i | grep memory memory_limit => 2048M => 2048
It will run for a good 2-3 minutes before throwing the error.
I assumed there was something odd with my local environment so held on as I was reloading the mac, but the issue has followed me to a fresh install.
I did notices the number of bytes it refers too is ~1.6GB, this figure doesn't change with php cli's memory limit, for example if I drop the limit to 512MB I get the same allowed memory size figure, which suggests to me there is another php binary in play here, but I don't know enough about how the craft cli works to troubleshoot that.
When this happens, in most cases I can complete the update using composer, but it's a hack that I don't want to continue with.
Versions are as follows:
Craft: All 3.1 and above, possibly 3.0 too but can't confirm Mamp: 5.51 php cli: 7.2.21 Composer: 1.9.0 OS X: 10.14
Any ideas on how to troubleshoot this further?