memory limit setup static command in magento 2 code example
Example: magento2 memory limit
php -dmemory_limit=5G bin/magento setup:di:compile
OR
php -dmemory_limit=5G bin/magento setup:upgrade
OR
php -dmemory_limit=5G bin/magento ANY:CUSTOM_COMMAAND