If you get a memory message via the terminal during execution. For example : Allowed memory size of 134217728 bytes exhausted.

That allows you to force memory during output. You do this by using php instead of php, for example, this line php -dmemory_limit=512M


Example (indexing):

Normal: php bin/magento indexer:reindex

With memory limit: php -dmemory_limit=512M bin/magento indexer:reindex