Reputation: 9920
I recently had an issue with composer, while I was installing a symfony2 bundle.
The free memory on my VM was 700M
, but it wasn't enough. It only worked after I stopped some services and freed 1.2G
.
Composer documentation doesn't specify much about this:
Note: Composer internally increases the memory_limit to
512M
. If you have memory issues when using composer, please consider creating an issue ticket so we can look into it.
My question is - what does composer do internally that uses so much memory ?
In my mind, the process is fairly
simple, basically check dependencies between modules, then download module archives, and modify certain files. I presume the algorithms to negotiate a version of all the modules with X
stability aren't simple at all, but is this a common problem between package managers for other programming languages, or is it a composer optimization issue ? (I haven't heard of such problems with RubyGems, for example).
Upvotes: 9
Views: 2648
Reputation: 42056
Most other dependency managers don't have complete SAT solver and do "approximations" which require much less comparisons (so less cpu, less memory) but in some cases can yield invalid results or unsolvable things where package managers like bower will ask you what you want to do. The Composer solver usually finds a solution or conclusively finds a conflict.
So in short this is a design choice, but I realize this is also a problem due to the memory usage. There are a few strategies that should result in lower memory usage, but they are time-consuming things to even try and not many people have enough project-knowledge or time to make this happen, so it's kinda stalled at the moment.
Upvotes: 7