cancel
Showing results for 
Search instead for 
Did you mean: 

2.4.1 setup:di:compile out of memory

2.4.1 setup:di:compile out of memory

Using Magento 2.4.1.  Running commands from Cpanel Terminal.

 

What am I missing to fix out of memory messages?

php -i | grep "memory_limit"

result ==>  memory_limit => 8192M => 8192M

 

then ran

php bin/magento setup:di:compile Compilation was started.
Repositories code generation... 1/9 [===>------------------------]  11% < 1 sec 87.0 MiB
mmap() failed: [12] Cannot allocate memory
mmap() failed: [12] Cannot allocate memory
Fatal error: Out of memory (allocated 190840832) (tried to allocate 135168 bytes) in /home/xxxxt/public_html/setup/src/Magento/Setup/Module/Di/Code/Reader/FileClassScanner.php on line 115

thereafter

php -dmemory_limit=8G bin/magento setup:di:compile
Compilation was started.
Repositories code generation... 1/9 [===>------------------------]  11% < 1 sec 87.0 MiBOut of memory

php -dmemory_limit=5G bin/magento setup:di:compileCompilation was started.
Repositories code generation... 1/9 [===>------------------------]  11% < 1 sec 87.0 MiBOut of memory

php -dmemory_limit=8G bin/magento setup:di:compile
Compilation was started.
Repositories code generation... 1/9 [===>------------------------]  11% < 1 sec 87.0 MiBOut of memory

 

 

 

6 REPLIES 6

Re: 2.4.1 setup:di:compile out of memory

Hi, 

I think there should be a space after -d and I used php-cli with full path whenever I get any issues.

 

Lately havent got any issue, earlier my command was...

/usr/local/php71/bin/php-cli -d memory_limit=6G bin/magento setup:di:compile

(pl change above as per your version of php & memory)



---------------

“The definition of insanity is doing the same thing over and over again, but expecting different results.” - Albert Einstein

Re: 2.4.1 setup:di:compile out of memory

Hi Shailesh,

 

I need to run the commands in cpanel terminal.  Using php 7.4. Please state correct syntax.   Thanks.

 

 

Re: 2.4.1 setup:di:compile out of memory

error when I run it from root

[root@server ~]# /usr/local/php74/bin/php-cli -d memory_limit=8G bin/magento setup:di:compile
bash: /usr/local/php74/bin/php-cli: No such file or directory

Re: 2.4.1 setup:di:compile out of memory

php74.JPG

 

 

 

 

 

For me, I have php-cli in /usr/local/php74/bin/

So, it doesnt give file not found for me.

https://prnt.sc/wiwgj6

 



---------------

“The definition of insanity is doing the same thing over and over again, but expecting different results.” - Albert Einstein

Re: 2.4.1 setup:di:compile out of memory

Fix Allowed Memory Exhausted Error When Compile Code In Magento 2 :-  Sometimes when we execute compile  or deploy command it gives allowed memory size exhausted error.

 

<span class="typ">Fatal</span><span class="pln"> error</span><span class="pun">:</span> <span class="typ">Allowed</span><span class="pln"> memory size of </span><span class="lit">134217728</span><span class="pln"> bytes exhausted </span>

 

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

Hope so it will help you.

Re: 2.4.1 setup:di:compile out of memory

I will try it. Thanks.