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

 

 

 

4 REPLIES 4

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