首页 > 解决方案 > 致命错误:允许的内存大小为 1610612736 字节已用尽但已分配 1.75G

问题描述

我不断收到此内存错误

PHP Fatal error:  Allowed memory size of 1610612736 bytes exhausted 
(tried to allocate 67108864 bytes) in 
phar:///usr/local/bin/composer/src/Composer/
   DependencyResolver/Solver.php on line 220

我已经尝试了一切。已经增加了几次内存限制。我已经重新下载了 composer 和 composer.phar。我在全新安装时克隆了我的 repo,第一个成功了composer install。由于某种原因,之后的每次尝试都会导致此错误。

我什至从 master 分支和我的分支中删除了可能导致此问题的文件中的任何差异。

PhP 版本 7.1.25 Composer 版本 1.7.2

我在 config.yml 文件中编辑的代码

create_course_space_whitelist_expression: '"staff" in affiliations or 
"employee" in affiliations or "faculty" in affiliations or "guest" in 
affiliations or "GR" in student_level'

旧代码:

create_course_space_whitelist_expression: '"staff" in affiliations or 
"employee" in affiliations or "faculty" in affiliations or "guest" in 
affiliations

不知道还能去哪里看。我在 Vendor 中更新了两个创建的文件,但我在运行之前删除了 vendorcomposer install

编辑:

我已经能够缩小原因。composer install在使用干净版本的 repo 分支时工作正常。但是,当对 composer.json 文件进行任何更改时,它会失败

标签: phpmemorycomposer-phpout-of-memory

解决方案


运行此命令为我修复了它

php -d memory_limit=-1 /usr/local/bin/composer install


推荐阅读