You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cabal uses too much memory when solving for setup dependencies #2899
Some combinations of setup and library dependencies cause the solver to use more and more memory. I ran cabal install --dry-run --max-backjumps -1 with this cabal file for five minutes with about 16GB of memory. I used GHC 7.10.2.
name: example
version: 0.1.0.0
cabal-version: >=1.8
build-type: Custom
custom-setup
setup-depends: aeson, hackage-server, yi
library
build-depends: aeson, mtl, leksah
My best guess is that it is related to the addLinking function creating linked nodes from existing unlinked nodes. When a node is referenced by a later sibling, it probably isn't garbage collected immediately after it is traversed.
I encountered this issue again while testing with a long-running command: cabal install leksah yesod hackage-server
This uses GHC 8.0.1.
The -v3 log shows that the solver chose to link a setup dependency near the top of the tree (level 8). It didn't return to that level until around the time that the memory usage dropped. When it descended again, it used a different goal order and chose the setup dependencies much farther down in the tree. I think that the spike in memory usage can be explained by the solver retaining the whole subtree starting where it chose the first setup dependency.
Activity
23Skidoo commentedon Oct 28, 2015
/cc @edsko, @kosmikus
Solver: Fix space leak in 'addlinking' (issue haskell#2899)
sebright commentedon Jul 10, 2016
I encountered this issue again while testing with a long-running command:
cabal install leksah yesod hackage-serverThis uses GHC 8.0.1.

The -v3 log shows that the solver chose to link a setup dependency near the top of the tree (level 8). It didn't return to that level until around the time that the memory usage dropped. When it descended again, it used a different goal order and chose the setup dependencies much farther down in the tree. I think that the spike in memory usage can be explained by the solver retaining the whole subtree starting where it chose the first setup dependency.
Test case for issue haskell#2899
Solver: Fix space leak in 'addlinking' (issue haskell#2899).
Solver: Fix space leak in 'addlinking' (issue haskell#2899).
Test case for issue haskell#2899.
Test case for issue haskell#2899.
Solver: Fix space leak in 'addlinking' (issue haskell#2899).
Test case for issue haskell#2899.
Solver: Fix space leak in 'addlinking' (issue haskell#2899).
Test case for issue haskell#2899.
Merge pull request #4110 from grayjay/issue-2899-2
sebright commentedon Dec 1, 2016
Fixed in #4110.