Skip to content

cabal uses too much memory when solving for setup dependencies #2899

Closed

Description

@sebright

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

cabal-memory-usage

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.

return $ PChoice qpn gr (cs' `P.union` P.fromList newCs)

Activity

  1. 23Skidoo commented on Oct 28, 2015

    @23Skidoo
    Member
  2. sebright commented on Jul 10, 2016

    @sebright
    CollaboratorAuthor

    I encountered this issue again while testing with a long-running command: cabal install leksah yesod hackage-server

    This uses GHC 8.0.1.
    issue-2899

    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.

  3. added a commit that references this issue on Jul 17, 2016
  4. self-assigned this
    on Nov 27, 2016
  5. added a commit that references this issue on Dec 1, 2016
  6. sebright commented on Dec 1, 2016

    @sebright
    CollaboratorAuthor

    Fixed in #4110.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions