Solution for Fatalerror: setup\src\Magento\Di\Code\Reader\FileClassScanner.php on line 81 in magento2

When you execute the setup:di:compile in magento2, you may get the chances to get the following error message from the terminal.

Error message:
Fatalerror: Allowed memory size of 134217728 bytes exhausted (tried to allocate 86016 bytes) in setup\src\Magento\Di\Code\Reader\FileClassScanner.php on line 81 Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.

Solution:
Execute command with some additional memory to resolve this issue.

Ex: php -dmemory_limit=5G bin/magento setup:di:compile

Here i have specify 5G of memory additional & then it start works.We can also increase the memory limit from ini file level. But not suggested to maximize the limit from certain limit of memory from the ini file.

 

CORNER OF BLOG:

“SAVE WATER”