Sometimes when we execute compile  or deploy command it gives allowed memory size exhausted error.

Fatal error: Allowed memory size of 134217728 bytes exhausted 

To fix this issue you need to increase memory allocated to php. To increase memory limit you have to set memory_limit parameter to 256M or 512M in php.ini file.

Or for quick solution add memory limit in the command :

php -d memory_limit=1G bin/magento setup:di:compile

php -d memory_limit=1G bin/magento setup:static-content:deploy