Forgive the cross posting (https://community.magento.com/t5/Magento-2-x-Version-Upgrades/Weird-memory-limit-Unable-to-run-compi...)
Hoping for a better response in here!
Site upgraded to 2.2.6, since upgrade, compiler will not run, complaining about a memory limit of 512MB:
Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 20480 bytes) in /var/www/vhosts/test.domain.co.uk/httpdocs/setup/src/Magento/Setup/Module/Di/Compiler/Config/Chain/PreferencesResolving.php on line 43
However there is no such memory limit. PHP -i shows the limit to be 8000M. I can also call PHP -d and pass a memory limit there, which is also ignored.
Memory limit must be set in the source code, however I can't find it... Any ideas?
OK - Dirty fix as below:
setup/src/Magento/Setup/Module/Di/Compiler/Config/Writer/Filesystem.php
public function write($key, array $config)
{
#Insert hack
ini_set('memory_limit','8000M');
#
$this->initialize();
$configuration = sprintf('<?php return %s;', var_export($config, true));
file_put_contents(
$this->directoryList->getPath(DirectoryList::GENERATED_METADATA) . '/' . $key . '.php',
$configuration
);
}
Talking to myself again, but if this gets anyone else, the problem is here:
httpdocs / app / code / BoostMyShop / SmartPrice / Controller / Adminhtml / Seller / TokenInput.php
Line 3:
ini_set('memory_limit', '512M'); //TODO : move this ?
Yes BoostMyShop, maybe you should move this...
Commented out and now I can compile.
Hello @RossCC
You can run compilation command as follows:
For Compilation command,
php -dmemory_limit=-1 bin/magento setup:di:compile
For Deployment
php -dmemory_limit=-1 bin/magento setup:static-content:deploy
Please let me know if still, you face the issue.
Hi Manish - this doesn't work i'm afraid. The memory limit is being over-ridden by the script, so setting it to unlimited has no effect, as the compilation process itself set the limit back to 512MB.
See above for my fix - the limit was hard-coded in a module which I have now removed.
Hey, Please tell me how did you find the problem as I have the same problem but I don't have BoostMyShop.