Can Composer2 reduce or avoid fatal errors due to insufficient memory?

藏色散人
Release: 2020-12-09 13:42:38
forward
1664 people have browsed it

The following tutorial column will introduce you to Composer 2. It can really reduce or avoid fatal errors of insufficient memory. I hope it will be helpful to friends in need!

Today I plan to update a project to Laravel 8. After adjusting the dependency version, when running

composer updateCan Composer2 reduce or avoid fatal errors due to insufficient memory?, the damn thing about memory The fatal error of not being enough appears again:

PHP Fatal error:  Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes)
Copy after login

It feels like it can never be satisfied. I reflexively looked for a solution first. Of course I knew what to do, but I forgot the order. During the search process, I was reminded of Composer 2. I remember that it was said to have "smaller memory footprint", and it is very convenient to upgrade and roll back the version. You might as well give it a try and upgrade it immediately:

composer self-update --2

Updating to version 2.0.8 (2.x channel).
   Downloading (100%)
Use composer self-update --rollback to return to version 1.10.19
Copy after login

The upgrade is completed in the gap, and then the update package command is executed. This time no error is reported, and the packages start to be installed one by one. Through the use of this package installation, I have some intuitive feelings:

In terms of progress, v1 requires a long analysis time, and then the installation is completed quickly, while v2 analysis It’s fast. The installation progress is output one by one. It feels like downloading and installing one by one, but the speed is not slow.

v1 During installation, the fan of my computer started to speed up, the sound became obviously louder, and the memory was occupied. rise, but v2 is much calmer
  • v2 does not directly display the output of recommended packages and packages that require financial support
  • I don’t know about other problems after the upgrade. I found There is not much feedback on the use of Composer 2. But at least the optimization of memory usage can greatly reduce or avoid the occurrence of insufficient memory.
  •                                                                                                                       

The above is the detailed content of Can Composer2 reduce or avoid fatal errors due to insufficient memory?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:learnku.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template